Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutagen fails on ID3v2.4 tags with footer #5

Closed
lazka opened this issue Jul 4, 2014 · 3 comments
Closed

Mutagen fails on ID3v2.4 tags with footer #5

lazka opened this issue Jul 4, 2014 · 3 comments
Labels
bug

Comments

@lazka
Copy link
Member

@lazka lazka commented Jul 4, 2014

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From steven.strobe.cc@gmail.com on June 18, 2009 19:06:00

From https://code.google.com/p/quodlibet/issues/detail?id=200 :

There is a bug in mutagen's penantic check on ID3v2 header flags. This
check always fails on ID3v2.4 tags with a tag footer.

In id3.py, there is the following bit of code which intends to disallow
flag 0x10 (footer present) for ID3v2.3. However, the code effectively also
disallows this flag for ID3v2.4 flags:

  if (2,4,0) <= self.version and (flags & 0x0f):
    raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))
  elif (2,3,0) <= self.version and (flags & 0x1f):
    raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))

I suggest chaning it into:
  if (2,4,0) <= self.version:
    if (flags & 0x0f):
      raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))
  elif (2,3,0) <= self.version:
    if (flags & 0x1f):
      raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))

Error message:
>>> f = mutagen.File('01_preludium.mp3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/mutagen/__init__.py", line 199, in
File
    if score > 0: return Kind(filename)
  File "/usr/lib/python2.5/site-packages/mutagen/__init__.py", line 74, in

init
self.load(filename, _args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 1945, in load
try: self.tags = ID3(filename, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 74, in init
super(ID3, self).init(_args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/_util.py", line 103, in
init
super(DictProxy, self).init(_args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/init.py", line 38, in
init
self.load(_args, **kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 113, in load
self.__load_header()
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 220, in
__load_header
raise ValueError("'%s' has invalid flags %#02x" % (fn, flags))
ValueError: '01_id3v22_preludium.mp3' has invalid flags 0x90

Original issue: http://code.google.com/p/mutagen/issues/detail?id=5


@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From joe.wreschnig@gmail.com on June 24, 2009 02:05:38

Status: Accepted

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From joe.wreschnig@gmail.com on June 24, 2009 02:05:29

Labels: -Priority-Low Priority-High NeedsTest

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From joe.wreschnig@gmail.com on July 04, 2009 18:35:26

Fixed in r34 , however we still don't have a real-world test.

Status: Fixed

@lazka lazka added trivial bug labels Apr 7, 2016
@lazka lazka closed this Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.