beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.6k stars 1.8k forks source link

uncaught Mutagen exception in open #2440

Closed anon1y4012 closed 7 years ago

anon1y4012 commented 7 years ago

I'm seeing about 80% of my files returning the "uncaught Mutagen exception in open" error, after about a third of the library the program will simply hang.

I've tested this with and without plugins.

The command I'm running is simply beet import /Path/to/folder

Which then returns the following:

uncaught Mutagen exception in open: 'MPEGFrame' object has no attribute 'length'
unreadable file: /Users/john/Music/iTunes/iTunes Media/Music/Radiohead/The King of Limbs_ Live From the Basement/10 Give Up the Ghost.mp3
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/beets-1.4.3-py2.7.egg/beets/mediafile.py", line 132, in mutagen_call
    return func(*args, **kwargs)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/_util.py", line 137, in wrapper_func
    return func(h, *args, **kwargs)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/_file.py", line 295, in File
    return Kind(fileobj, filename=filething.filename)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/_file.py", line 48, in __init__
    self.load(*args, **kwargs)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/_util.py", line 129, in wrapper
    return func(self, h, *args, **kwargs)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/id3/_file.py", line 406, in load
    self.info = self._Info(fileobj, offset)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/_util.py", line 158, in wrapper
    return func(*args, **kwargs)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/mp3/__init__.py", line 363, in __init__
    frame = MPEGFrame(fileobj)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/mp3/__init__.py", line 168, in __init__
    self._parse_vbr_header(fileobj, self.frame_offset, frame_size)
  File "/Users/john/Library/Python/2.7/lib/python/site-packages/mutagen/mp3/__init__.py", line 196, in _parse_vbr_header
    if xing.bytes != -1 and self.length:
AttributeError: 'MPEGFrame' object has no attribute 'length

Setup

My configuration (output of beet config) is:

lyrics: bing_lang_from: [] auto: yes bing_client_secret: REDACTED google_API_key: REDACTED force: no google_engine_ID: REDACTED sources:

plugins: fetchart lastgenre lyrics library: /Users/john/Music/Database/musiclibrary.db


directory: /Users/john/Music/Beets
library: /Users/john/Music/Database/musiclibrary.db
plugins: fetchart lastgenre lyrics
fetchart:
    cautious: true
    cover_names: front back
    sources: itunes *
lastgenre:
     auto: yes
lyrics:
     auto: yes
sampsyo commented 7 years ago

Thanks for reporting! That's troubling.

To help narrow down the problem, can you isolate a file that triggers the problem?

Then, let's try running Mutagen on the file directory. Try running mid3v2 /path/to/file.mp3 and see if the same exception gets triggered.

anon1y4012 commented 7 years ago

Ok, I ran it on a known bad file and got a promising result.

IDv2 tag info for /Users/john/Desktop/The 2nd Law/01 Supremacy.mp3 APIC=other, (image/jpeg, 121292 bytes) TALB=The 2nd Law TDOR=2012 TDRC=2012 TIPL=[unrepresentable data] TIT2=Supremacy TMED=CD TPE1=Muse TPE2=Muse TPE3=David Campbell TPOS=1/1 TPUB=Warner Music UK Ltd. TRCK=1/13 TSO2=Muse TSOP=Muse TSRC=GBAHT1200389 TXXX=ASIN=B008G12EVS TXXX=Artists=Muse TXXX=BARCODE=825646568802 TXXX=CATALOGNUMBER=825646568802 TXXX=MusicBrainz Album Artist Id=9c9f1380-2516-4fc9-a3e6-f9f61941d090 TXXX=MusicBrainz Album Id=2e5053f0-3023-4700-9660-a876145819a1 TXXX=MusicBrainz Album Release Country=FR TXXX=MusicBrainz Album Status=official TXXX=MusicBrainz Album Type=album TXXX=MusicBrainz Artist Id=9c9f1380-2516-4fc9-a3e6-f9f61941d090 TXXX=MusicBrainz Release Group Id=422cd8ac-8599-4356-b874-4da79a06abac TXXX=MusicBrainz Release Track Id=92204a31-b471-3eed-b8b0-1d1867fcdb38 TXXX=SCRIPT=Latn TXXX=iTunes PID=362a9d0a6e765264 TXXX=originalyear=2012 UFID=http://musicbrainz.org='f8f583d7-7280-45e1-86cb-3c0dd05b06d8'

sampsyo commented 7 years ago

Hmm, that's odd—I wonder why this didn't crash when calling the Mutagen tool directly. Any chance you can share a copy of a crash-triggering file so we can reproduce the problem (even privately)?

anon1y4012 commented 7 years ago

Sure thing.

Any chance that an uninstall/reinstall could fix it? If so, what's the most efficient way to uninstall?

Link to file here.

anon1y4012 commented 7 years ago

Just to update, I've done some digging and it seems that it could be related to files that are supposed to be .mp3 but aren't in actuality.

I'm not sure this is the case since all these files play just fine, but it might be a start.

lazka commented 7 years ago

I can reproduce and have filed https://github.com/quodlibet/mutagen/issues/292

sampsyo commented 7 years ago

Awesome. Thank you, @lazka.