X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4f5547ad4cd06de77bdf0607e38aab2d45080bfc..14fef303c668733a4ff0458bc468595e4a1629ab:/lib/mutagen/optimfrog.py diff --git a/lib/mutagen/optimfrog.py b/lib/mutagen/optimfrog.py new file mode 100644 index 000000000..902c05723 --- /dev/null +++ b/lib/mutagen/optimfrog.py @@ -0,0 +1,64 @@ +# OptimFROG reader/tagger +# +# Copyright 2006 Lukas Lalinsky +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# $Id: optimfrog.py 4275 2008-06-01 06:32:37Z piman $ + +"""OptimFROG audio streams with APEv2 tags. + +OptimFROG is a lossless audio compression program. Its main goal is to +reduce at maximum the size of audio files, while permitting bit +identical restoration for all input. It is similar with the ZIP +compression, but it is highly specialized to compress audio data. + +Only versions 4.5 and higher are supported. + +For more information, see http://www.losslessaudio.org/ +""" + +__all__ = ["OptimFROG", "Open", "delete"] + +import struct +from mutagen.apev2 import APEv2File, error, delete + +class OptimFROGHeaderError(error): pass + +class OptimFROGInfo(object): + """OptimFROG stream information. + + Attributes: + channels - number of audio channels + length - file length in seconds, as a float + sample_rate - audio sampling rate in Hz + """ + + def __init__(self, fileobj): + header = fileobj.read(76) + if (len(header) != 76 or not header.startswith("OFR ") or + struct.unpack("