diff --git a/pymeds.py b/pymeds.py index 1bf3414..6f75577 100755 --- a/pymeds.py +++ b/pymeds.py @@ -87,6 +87,38 @@ class PyMedS(service.MultiService): def startService(self): service.MultiService.startService(self) +def fixupmimetypes() + # Purely to ensure some sane mime-types. On MacOSX I need these. + # XXX - There isn't any easier way to get to the mime-type dict + # that I know of. + medianode = static.File('pymediaserv') + medianode.contentTypes.update( { + # From: http://support.microsoft.com/kb/288102 + '.asf': 'video/x-ms-asf', + '.asx': 'video/x-ms-asf', + '.wma': 'audio/x-ms-wma', + '.wax': 'audio/x-ms-wax', + '.wmv': 'video/x-ms-wmv', + '.wvx': 'video/x-ms-wvx', + '.wm': 'video/x-ms-wm', + '.wmx': 'video/x-ms-wmx', + + # From: http://www.matroska.org/technical/specs/notes.html + '.mkv': 'video/x-matroska', + '.mka': 'audio/x-matroska', + + #'.ts': 'video/mp2t', + '.ts': 'video/mpeg', # we may want this instead of mp2t + '.m2t': 'video/mpeg', + '.m2ts': 'video/mpeg', + '.mp4': 'video/mp4', + #'.mp4': 'video/mpeg', + '.dat': 'video/mpeg', # VCD tracks + '.ogm': 'application/ogg', + '.vob': 'video/mpeg', + #'.m4a': 'audio/mp4', # D-Link can't seem to play AAC files. + }) + def makeService(config): listenAddr = config['addr'] listenPort = config['port'] @@ -146,37 +178,7 @@ def makeService(config): root.putChild('content', content) - # Purely to ensure some sane mime-types. On MacOSX I need these. - # XXX - There isn't any easier way to get to the mime-type dict - # that I know of. - medianode = static.File('pymediaserv') - medianode.contentTypes.update( { - # From: http://support.microsoft.com/kb/288102 - '.asf': 'video/x-ms-asf', - '.asx': 'video/x-ms-asf', - '.wma': 'audio/x-ms-wma', - '.wax': 'audio/x-ms-wax', - '.wmv': 'video/x-ms-wmv', - '.wvx': 'video/x-ms-wvx', - '.wm': 'video/x-ms-wm', - '.wmx': 'video/x-ms-wmx', - - # From: http://www.matroska.org/technical/specs/notes.html - '.mkv': 'video/x-matroska', - '.mka': 'audio/x-matroska', - - #'.ts': 'video/mp2t', - '.ts': 'video/mpeg', # we may want this instead of mp2t - '.m2t': 'video/mpeg', - '.m2ts': 'video/mpeg', - '.mp4': 'video/mp4', - #'.mp4': 'video/mpeg', - '.dat': 'video/mpeg', # VCD tracks - '.ogm': 'application/ogg', - '.vob': 'video/mpeg', - #'.m4a': 'audio/mp4', # D-Link can't seem to play AAC files. - }) - del medianode + fixupmimetypes() site = server.Site(root) internet.TCPServer(listenPort, site).setServiceParent(serv)