From 41c0fb950cf2b7b29a2106114247e9ca70f2609e Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 19 Oct 2016 13:36:24 +0200 Subject: [PATCH] fix except clauses in bookmedia --- src/catalogue/models/bookmedia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/catalogue/models/bookmedia.py b/src/catalogue/models/bookmedia.py index 1f984a044..39ebf496c 100644 --- a/src/catalogue/models/bookmedia.py +++ b/src/catalogue/models/bookmedia.py @@ -124,13 +124,13 @@ class BookMedia(models.Model): audio = id3.ID3(filepath) return [t.data for t in audio.getall('PRIV') if t.owner == 'wolnelektury.pl?flac_sha1'][0] - except MutagenError: + except (MutagenError, IndexError): return None elif filetype == 'ogg': try: audio = mutagen.File(filepath) return audio.get('flac_sha1', [None])[0] - except (MutagenError, AttributeError): + except (MutagenError, AttributeError, IndexError): return None else: return None -- 2.20.1