From 7d1fac44e910971d5261ad4e7881424e5e3577f2 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 5 May 2020 23:57:37 +0200 Subject: [PATCH] Update non collection songs with manually unset cover --- src/covermanager/albumcoverloader.cpp | 6 +++--- src/playlist/playlist.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/covermanager/albumcoverloader.cpp b/src/covermanager/albumcoverloader.cpp index 7bb3951b4..fa5d10479 100644 --- a/src/covermanager/albumcoverloader.cpp +++ b/src/covermanager/albumcoverloader.cpp @@ -315,7 +315,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(Task *task) { !task->options.scale_output_image_ && !task->options.pad_output_image_) { task->song.InitArtManual(); - if (task->art_manual != task->song.art_manual()) { + if (task->song.art_manual_is_valid() && task->art_manual != task->song.art_manual()) { task->art_manual = task->song.art_manual(); task->art_updated = true; } @@ -338,12 +338,12 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(Task *task) { if (!cover_url.isEmpty() && !cover_url.path().isEmpty()) { if (cover_url.path() == Song::kManuallyUnsetCover) { - return TryLoadResult(false, true, AlbumCoverLoaderResult::Type_ManuallyUnset, QUrl(), task->options.default_output_image_); + return TryLoadResult(false, true, AlbumCoverLoaderResult::Type_ManuallyUnset, cover_url, task->options.default_output_image_); } else if (cover_url.path() == Song::kEmbeddedCover && task->song_url.isLocalFile()) { const QImage taglib_image = TagReaderClient::Instance()->LoadEmbeddedArtBlocking(task->song_url.toLocalFile()); if (!taglib_image.isNull()) { - return TryLoadResult(false, true, AlbumCoverLoaderResult::Type_Embedded, QUrl(), ScaleAndPad(task->options, taglib_image).first); + return TryLoadResult(false, true, AlbumCoverLoaderResult::Type_Embedded, cover_url, ScaleAndPad(task->options, taglib_image).first); } } else if (cover_url.isLocalFile()) { diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index e6581e537..079cfe94c 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -2029,9 +2029,9 @@ void Playlist::UpdateScrobblePoint(const qint64 seek_point_nanosec) { void Playlist::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result) { // Update art_manual for local songs that are not in the collection. - if (result.type == AlbumCoverLoaderResult::Type_Manual && result.cover_url.isLocalFile() && (song.source() == Song::Source_LocalFile || song.source() == Song::Source_CDDA || song.source() == Song::Source_Device)) { + if (((result.type == AlbumCoverLoaderResult::Type_Manual && result.cover_url.isLocalFile()) || result.type == AlbumCoverLoaderResult::Type_ManuallyUnset) && (song.source() == Song::Source_LocalFile || song.source() == Song::Source_CDDA || song.source() == Song::Source_Device)) { PlaylistItemPtr item = current_item(); - if (item && item->Metadata() == song && !item->Metadata().art_manual_is_valid()) { + if (item && item->Metadata() == song && (!item->Metadata().art_manual_is_valid() || (result.type == AlbumCoverLoaderResult::Type_ManuallyUnset && !item->Metadata().has_manually_unset_cover()))) { qLog(Debug) << "Updating art manual for local song" << song.title() << song.album() << song.title() << "to" << result.cover_url << "in playlist."; item->SetArtManual(result.cover_url); Save();