thebigmunch / audio-metadata

A library for reading and, in the future, writing audio metadata. https://audio-metadata.readthedocs.io/
https://forum.thebigmunch.me
MIT License
53 stars 11 forks source link

frame_data.split(b'\x00') may return more than two values #38

Closed iiegn closed 4 years ago

iiegn commented 4 years ago

while using google-music-script i'm seeing this error:

owner, identifier = frame_data.split(b'\x00')
ValueError: too many values to unpack (expected 2)

https://github.com/thebigmunch/audio-metadata/blob/79fd165f886f2a380fd7beb678f3715a64764770/src/audio_metadata/formats/id3v2_frames.py#L1193

this might be due to some misbehaving file. however, this should be dealt with more gently - i guess, here (that's why i'm filling an issue here; if you want it at gms, i'll file it there...).

btw, quick fix:

owner, identifier = frame_data.split(b'\x00', 1)

but i have no idea about the possible ramifications of this fix!

thebigmunch commented 4 years ago

You are correct in the solution; this is simply a matter of me forgetting to set the maxsplit argument in a frenzy of adding ID3v2 frames.

I actually had a file locally that I tested with but turns out it didn't have any null bytes in the identifier to cause this error to pop up ^_^

Thanks for the report.