1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-10 04:02:17 +00:00

B"H check old albums when track metadata changed

This commit is contained in:
hhm 2016-09-09 00:58:50 -04:00
parent eeb23a641e
commit 0ca628a8fd

View File

@ -154,7 +154,11 @@ class Scanner:
tr.genre = self.__try_read_tag(tag, 'genre')
tr.duration = int(tag.info.length)
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.content_type = get_mime(os.path.splitext(path)[1][1:])
tr.last_modification = os.path.getmtime(path)