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)