leosongwei / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
0 stars 0 forks source link

add md5 verification for FLAC audio streams #83

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be really great if mutagen could verify FLAC audio streams using the 
built-in md5 signature in the streaminfo block . I could see it working like 
this:

from mutagen.flac import FLAC
f = FLAC('somefile.flac')
# Throws an exception when md5 signature from streaminfo doesn't match the 
calculated md5 for the audio stream
f.verify()

or perhaps:
# Throws an exception when md5 signature from streaminfo doesn't match the 
calculated md5 for the audio stream
f = FLAC('somefile.flac', verify_signature=True)

maybe both

Original issue reported on code.google.com by stevecr...@gmail.com on 8 Feb 2011 at 7:17

GoogleCodeExporter commented 9 years ago
Given that the MD5 signature is calculated from raw audio data, you need to 
decode the file to verify the signature. I don't think Mutagen is going to get 
a FLAC decoder.

Original comment by lalinsky on 30 Mar 2011 at 2:34

GoogleCodeExporter commented 9 years ago
Lukáš is right; I'm not prepared to include a FLAC decoder, especially in 
Python. The MD5 is provided in the info.md5_signature attribute, which means 
you should be able to just run
    flac -o foo.flac | md5sum -

in Python and get a number for comparison.

Original comment by joe.wreschnig@gmail.com on 17 Apr 2011 at 11:53