From 4bee23ce23f43382ba72cbe22abc38bf06295438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alban=20F=C3=A9ron?= Date: Sun, 30 Jan 2022 16:30:05 +0100 Subject: [PATCH] Fix covers not being scanned as such when modified --- supysonic/scanner.py | 4 ++-- supysonic/watcher.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/supysonic/scanner.py b/supysonic/scanner.py index bde3192..24e60b7 100644 --- a/supysonic/scanner.py +++ b/supysonic/scanner.py @@ -1,7 +1,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2013-2020 Alban 'spl0k' Féron +# Copyright (C) 2013-2022 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -345,7 +345,7 @@ class Scanner(Thread): cover_name = os.path.basename(path) if not folder.cover_art: folder.cover_art = cover_name - else: + elif folder.cover_art != cover_name: album_name = None track = folder.tracks.select().first() if track is not None: diff --git a/supysonic/watcher.py b/supysonic/watcher.py index f55e461..64b9001 100644 --- a/supysonic/watcher.py +++ b/supysonic/watcher.py @@ -1,7 +1,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2014-2019 Alban 'spl0k' Féron +# Copyright (C) 2014-2022 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -68,8 +68,10 @@ class SupysonicWatcherEventHandler(PatternMatchingEventHandler): def on_modified(self, event): logger.debug("File modified: '%s'", event.src_path) - if not covers.is_valid_cover(event.src_path): - self.queue.put(event.src_path, OP_SCAN) + op = OP_SCAN + if covers.is_valid_cover(event.src_path): + op |= FLAG_COVER + self.queue.put(event.src_path, op) def on_moved(self, event): logger.debug("File moved: '%s' -> '%s'", event.src_path, event.dest_path)