1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-23 01:16:18 +00:00

Merge remote-tracking branch 'hhm0/rescan_albums'

This commit is contained in:
spl0k 2016-09-09 22:46:55 +02:00
commit 5fb98d96f5

View File

@ -154,7 +154,11 @@ 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)
if not add: if not add:
tr.album = self.__find_album(self.__try_read_tag(tag, 'artist', ''), self.__try_read_tag(tag, 'album', '')) old_album = tr.album
new_album = self.__find_album(self.__try_read_tag(tag, 'artist', ''), self.__try_read_tag(tag, 'album', ''))
if old_album.id != new_album.id:
tr.album = new_album
self.__albums_to_check.add(old_album)
tr.bitrate = (tag.info.bitrate if hasattr(tag.info, 'bitrate') else int(os.path.getsize(path) * 8 / tag.info.length)) / 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)