From 0ca628a8fd9dd58745950ef2bbb365d2d86b1198 Mon Sep 17 00:00:00 2001 From: hhm Date: Fri, 9 Sep 2016 00:58:50 -0400 Subject: [PATCH] B"H check old albums when track metadata changed --- supysonic/scanner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/supysonic/scanner.py b/supysonic/scanner.py index f3d1ba3..30155e3 100644 --- a/supysonic/scanner.py +++ b/supysonic/scanner.py @@ -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)