Example #1
0
    def decode(self, file, filename, streaming=True):
        name, ext = os.path.splitext(filename)
        if ext in PyOggDecoder.vorbis_exts:
            source = PyOggVorbisSource
        elif ext in PyOggDecoder.flac_exts:
            source = PyOggFLACSource
        elif ext in PyOggDecoder.opus_exts:
            source = PyOggOpusSource
        else:
            raise Exception(
                "Decoder could not find a suitable source to use with this filetype."
            )

        if streaming:
            return source(filename, file)
        else:
            return StaticSource(source(filename, file))
Example #2
0
 def decode(self, file, filename, streaming=True):
     if streaming:
         return WMFSource(filename, file)
     else:
         return StaticSource(WMFSource(filename, file))