CollectionBackend/CollectionWatcher: add HasSongsWithMissingLoudnessCharacteristics logic

Exactly identical to the "missing fingerprint" logic,
just for the two new fields being added.
This commit is contained in:
Roman Lebedev
2023-06-27 05:01:26 +03:00
committed by Jonas Kvinge
parent 0ea81b13b9
commit f905676b1c
4 changed files with 45 additions and 0 deletions

View File

@@ -195,6 +195,7 @@ CollectionWatcher::ScanTransaction::ScanTransaction(CollectionWatcher *watcher,
watcher_(watcher),
cached_songs_dirty_(true),
cached_songs_missing_fingerprint_dirty_(true),
cached_songs_missing_loudness_characteristics_dirty_(true),
known_subdirs_dirty_(true) {
QString description;
@@ -329,6 +330,21 @@ bool CollectionWatcher::ScanTransaction::HasSongsWithMissingFingerprint(const QS
}
bool CollectionWatcher::ScanTransaction::HasSongsWithMissingLoudnessCharacteristics(const QString &path) {
if (cached_songs_missing_loudness_characteristics_dirty_) {
const SongList songs = watcher_->backend_->SongsWithMissingLoudnessCharacteristics(dir_);
for (const Song &song : songs) {
const QString p = song.url().toLocalFile().section('/', 0, -2);
cached_songs_missing_loudness_characteristics_.insert(p, song);
}
cached_songs_missing_loudness_characteristics_dirty_ = false;
}
return cached_songs_missing_loudness_characteristics_.contains(path);
}
void CollectionWatcher::ScanTransaction::SetKnownSubdirs(const CollectionSubdirectoryList &subdirs) {
known_subdirs_ = subdirs;