From 45f60aaedb5a17fb1ce6fd14e6c4136f3411f14d Mon Sep 17 00:00:00 2001 From: spl0k Date: Wed, 16 Oct 2013 09:53:43 +0200 Subject: [PATCH] Fix for audio formats without bitrate --- scanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanner.py b/scanner.py index ea57b9a..907c1de 100755 --- a/scanner.py +++ b/scanner.py @@ -75,7 +75,7 @@ class Scanner: tr.genre = self.__try_read_tag(tag, 'genre') tr.duration = int(tag.info.length) tr.album = self.__find_album(self.__try_read_tag(tag, 'artist'), self.__try_read_tag(tag, 'album')) - tr.bitrate = tag.info.bitrate / 1000 + tr.bitrate = (tag.info.bitrate if hasattr(tag.info, 'bitrate') else int(os.path.getsize(path) * 8 / tag.info.length)) / 1000 tr.content_type = get_mime(os.path.splitext(path)[1][1:]) tr.last_modification = os.path.getmtime(path)