From fe4d9979cec27992816b41d4e8e54dd9e04a5b6a Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 17 Dec 2025 22:15:21 +0100 Subject: [PATCH] CollectionWatcher: Avoid re-scan of restored songs unless mtime is changed Fixes #1819 --- src/collection/collectionwatcher.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/collection/collectionwatcher.cpp b/src/collection/collectionwatcher.cpp index 153353ab7..e50576f9a 100644 --- a/src/collection/collectionwatcher.cpp +++ b/src/collection/collectionwatcher.cpp @@ -706,8 +706,14 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu qLog(Debug) << file << "is missing EBU R 128 loudness characteristics."; } + // If the song is unavailable and nothing has changed, just mark it as available without re-scanning + // For CUE files with multiple sections, all sections share the same file and would have the same availability status + if (matching_song.unavailable() && !changed && !missing_fingerprint && !missing_loudness_characteristics) { + qLog(Debug) << "Unavailable song" << file << "restored without re-scanning."; + t->readded_songs << matching_songs; + } // The song's changed or missing fingerprint - create fingerprint and reread the metadata from file. - if (t->ignores_mtime() || changed || missing_fingerprint || missing_loudness_characteristics) { + else if (t->ignores_mtime() || changed || missing_fingerprint || missing_loudness_characteristics) { QString fingerprint; #ifdef HAVE_SONGFINGERPRINTING @@ -728,12 +734,6 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu } } - // Nothing has changed - mark the song available without re-scanning - else if (matching_song.unavailable()) { - qLog(Debug) << "Unavailable song" << file << "restored."; - t->readded_songs << matching_songs; - } - } else { // Search the DB by fingerprint. QString fingerprint;