now catch MPEG frame errors

--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40126
This commit is contained in:
adrian.sampson 2009-02-07 23:04:26 +00:00
parent 9ac8134979
commit 6a4cb750d3

View file

@ -357,7 +357,11 @@ class MediaFile(object):
metadata."""
def __init__(self, path):
self.mgfile = mutagen.File(path)
try:
self.mgfile = mutagen.File(path)
except mutagen.mp3.HeaderNotFoundError:
raise FileTypeError('Mutagen could not read file')
if self.mgfile is None: # Mutagen couldn't guess the type
raise FileTypeError('file type unsupported by Mutagen')
elif type(self.mgfile).__name__ == 'M4A' or \