mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Fix for audio formats without bitrate
This commit is contained in:
parent
ba7365cfef
commit
45f60aaedb
@ -75,7 +75,7 @@ class Scanner:
|
|||||||
tr.genre = self.__try_read_tag(tag, 'genre')
|
tr.genre = self.__try_read_tag(tag, 'genre')
|
||||||
tr.duration = int(tag.info.length)
|
tr.duration = int(tag.info.length)
|
||||||
tr.album = self.__find_album(self.__try_read_tag(tag, 'artist'), self.__try_read_tag(tag, 'album'))
|
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.content_type = get_mime(os.path.splitext(path)[1][1:])
|
||||||
tr.last_modification = os.path.getmtime(path)
|
tr.last_modification = os.path.getmtime(path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user