leosongwei / mutagen

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

FLAC: Media Jukebox writes \x00-terminated FLAC tags #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using svn mutagen, running mutagen.File(filepath, easy=True) on a file
returns a dict where every value has \x00 appended. For example:

{'album': [u'Symphony No. 9\x00'], 'peak level':
[u'0.8750600218772888\x00'], 'title': [u'Allegro\x00'], 'replay gain':
[u'-5.7582697868347168\x00'], 'tool version': [u'12.0.37\x00'], 'artist':
[u'Shostakovitch\x00'], 'bpm': [u'134\x00'], 'date': [u'1899/12/30\x00'],
'intensity': [u'1\x00'], 'tool name': [u'Media Jukebox\x00'], 'genre':
[u'Classical\x00'], 'tracknumber': [u'1\x00']}

I've attached the first 32KB of the file of which mutagen created the above
output.

This happens on all flac files I have. I didn't encode them myself, but the
"tool name" field seems to yield which tool was used to encode. Now I can
workaround this with:

mutagenObj = mutagen.File(filepath, easy=True)
mutagenObj = dict((a, [e.strip("\0") for e in b]) for a, b in
mutagenObj.iteritems())

but that's kinda annoying. I wonder if all my flac files are broken, or if
mutagen does something weird when reading the file?

Original issue reported on code.google.com by Sphaerod...@gmail.com on 7 Sep 2009 at 1:18

Attachments:

GoogleCodeExporter commented 9 years ago
The FLAC files are "broken" (they're still valid but they probably did not 
intend to
include a \x00 in the string); you can see in a hex editor that every comment 
field
is \x00 terminated. http://www.xiph.org/vorbis/doc/v-comment.html explicitly 
says
"The vector length is encoded; the vector contents themselves are not null 
terminated." 

Original comment by joe.wreschnig@gmail.com on 7 Sep 2009 at 6:01

GoogleCodeExporter commented 9 years ago
Well then. Thanks for that info!

Original comment by Sphaerod...@gmail.com on 7 Sep 2009 at 10:17