source: trunk/src/testing/bin/fileServer/misc/mmpython/__init__.py @ 4

Revision 4, 4.5 KB checked in by ajaworski, 13 years ago (diff)

Added modified SAGE sources

Line 
1#!/usr/bin/python
2#if 0
3# -----------------------------------------------------------------------
4# $Id: __init__.py,v 1.35 2004/10/15 09:02:11 dischi Exp $
5# -----------------------------------------------------------------------
6# $Log: __init__.py,v $
7# Revision 1.35  2004/10/15 09:02:11  dischi
8# add ac3 parser
9#
10# Revision 1.34  2004/05/20 15:55:08  dischi
11# add xml file detection
12#
13# Revision 1.33  2004/05/02 08:28:20  dischi
14# dvd iso support
15#
16# Revision 1.32  2004/04/18 09:11:36  dischi
17# improved lsdvd support
18#
19# Revision 1.31  2004/04/17 18:38:54  dischi
20# add lsdvd parser to avoid problems with our own
21#
22# Revision 1.30  2004/01/31 12:24:39  dischi
23# add basic matroska info
24#
25# Revision 1.29  2004/01/27 20:27:52  dischi
26# remove cache, it does not belong in mmpython
27#
28# Revision 1.28  2004/01/03 17:44:04  dischi
29# catch OSError in case the file is removed file scanning
30#
31# Revision 1.27  2003/11/24 20:30:17  dischi
32# fix again, dvd may fail, but datadir may not
33#
34# Revision 1.26  2003/11/24 20:29:26  dischi
35# resort to let dvd work again
36#
37# Revision 1.25  2003/11/07 13:58:52  dischi
38# extra check for dvd
39#
40# Revision 1.24  2003/09/22 16:24:58  the_krow
41# o added flac
42# o try-except block around ioctl since it is not avaiable in all OS
43#
44# Revision 1.23  2003/09/14 13:50:42  dischi
45# make it possible to scan extention based only
46#
47# Revision 1.22  2003/09/10 18:41:44  dischi
48# add USE_NETWORK, maybe there is no network connection
49#
50# Revision 1.20  2003/08/26 13:16:41  outlyer
51# Enabled m4a support
52#
53# Revision 1.19  2003/07/10 11:17:35  the_krow
54# ogminfo is used to parse ogg files
55#
56# Revision 1.18  2003/07/01 21:07:42  dischi
57# switch back to eyed3info
58#
59# Revision 1.17  2003/06/30 13:17:18  the_krow
60# o Refactored mediainfo into factory, synchronizedobject
61# o Parsers now register directly at mmpython not at mmpython.mediainfo
62# o use mmpython.Factory() instead of mmpython.mediainfo.get_singleton()
63# o Bugfix in PNG parser
64# o Renamed disc.AudioInfo into disc.AudioDiscInfo
65# o Renamed disc.DataInfo into disc.DataDiscInfo
66#
67# -----------------------------------------------------------------------
68# MMPython - Media Metadata for Python
69# Copyright (C) 2003 Thomas Schueppel, Dirk Meyer
70#
71# This program is free software; you can redistribute it and/or modify
72# it under the terms of the GNU General Public License as published by
73# the Free Software Foundation; either version 2 of the License, or
74# (at your option) any later version.
75#
76# This program is distributed in the hope that it will be useful, but
77# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
78# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
79# Public License for more details.
80#
81# You should have received a copy of the GNU General Public License along
82# with this program; if not, write to the Free Software Foundation, Inc.,
83# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
84#
85# -----------------------------------------------------------------------
86#endif
87
88# Do this stuff before importing the info instances since they
89# depend on this function
90
91import factory
92
93from synchronizedobject import SynchronizedObject
94
95_factory = None
96
97def Factory():
98    global _factory
99
100    # One-time init
101    if _factory == None:
102        _factory = SynchronizedObject(factory.Factory())
103       
104    return _factory
105
106def registertype(mimetype,extensions,type,c):
107    f = Factory()
108    f.register(mimetype,extensions,type,c)   
109
110def gettype(mimetype,extensions):
111    f = Factory()
112    return f.get(mimetype,extensions)   
113   
114
115# Okay Regular imports and code follow
116
117import sys
118import os
119import mediainfo
120#import audio.ogginfo
121import audio.pcminfo
122import audio.m4ainfo
123import audio.ac3info
124import video.riffinfo
125import video.mpeginfo
126import video.asfinfo
127import video.movinfo
128import image.jpginfo
129import image.pnginfo
130import image.tiffinfo
131import image.ImageInfo
132import video.vcdinfo
133import video.realinfo
134import video.ogminfo
135import video.mkvinfo
136import misc.xmlinfo
137
138# import some disc modules (may fail)
139try:
140    import disc.discinfo
141    import disc.vcdinfo
142    import disc.audioinfo
143except ImportError:
144    pass
145
146# find the best working DVD module
147try:
148    import disc.lsdvd
149except ImportError:
150    pass
151
152try:
153    import disc.dvdinfo
154except ImportError:
155    pass
156
157# use fallback disc module
158try:
159    import disc.datainfo
160except ImportError:
161    pass
162
163import audio.eyed3info
164#import audio.mp3info
165import audio.webradioinfo
166import audio.flacinfo
167
168
169
170USE_NETWORK     = 1
171
172
173def parse(filename, ext_only = 0):
174    """
175    parse the file
176    """
177    return Factory().create(filename, ext_only)
178
Note: See TracBrowser for help on using the repository browser.