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
15 if song
.type in TYPE_MP3
and HAVE_MP3
:
17 elif song
.type in TYPE_OGG
and HAVE_OGG
:
19 elif song
.type in TYPE_FLAC
and HAVE_FLAC
:
21 elif song
.type in TYPE_WAV
and HAVE_WAV
:
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
)
37 raise ValueError, 'Unsupported file %s (type: %s).' % (name
, type)