Theme changes, fix for unicode conversion errors, misc
[rox-musicbox.git] / plugins / __init__.py
blob7ffe1b1f8a1de1c692c17eac8aa0fc979b595ca7
1 from _mp3 import *
2 from _flac import *
3 from _ogg import *
4 from _wav import *
7 TYPE_OGG = ['application/ogg', 'audio/x-vorbis+ogg']
8 TYPE_MP3 = ['audio/mpeg']
9 TYPE_FLAC = ['audio/x-flac']
10 TYPE_WAV = ['audio/x-wav']
11 TYPE_LIST = TYPE_OGG + TYPE_MP3 + TYPE_FLAC + TYPE_WAV
14 def get_info(song):
15 if song.type in TYPE_MP3 and HAVE_MP3:
16 _mp3.get_info(song)
17 elif song.type in TYPE_OGG and HAVE_OGG:
18 _ogg.get_info(song)
19 elif song.type in TYPE_FLAC and HAVE_FLAC:
20 _flac.get_info(song)
21 elif song.type in TYPE_WAV and HAVE_WAV:
22 _wav.get_info(song)
23 else:
24 raise ValueError, 'Unsupported file %s (type: %s).' % (song.filename, song.type)
27 def get_decoder(name, type, buffersize):
28 if (type in TYPE_OGG and HAVE_OGG):
29 return OGGDecoder(name, buffersize)
30 elif (type in TYPE_MP3 and HAVE_MP3):
31 return MP3Decoder(name, buffersize)
32 elif (type in TYPE_FLAC and HAVE_FLAC):
33 return FLACDecoder(name, buffersize)
34 elif (type in TYPE_WAV):
35 return WAVDecoder(name, buffersize)
36 else:
37 raise ValueError, 'Unsupported file %s (type: %s).' % (name, type)