From 6a4cb750d3da5b58112d412faa048e6cd89ff907 Mon Sep 17 00:00:00 2001 From: "adrian.sampson" Date: Sat, 7 Feb 2009 23:04:26 +0000 Subject: [PATCH] now catch MPEG frame errors --HG-- extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40126 --- beets/mediafile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beets/mediafile.py b/beets/mediafile.py index 9f9f76e44..1cc8198d5 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -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 \