Don't drop the embedded art indicator from songs when updating the library. Thanks markwatkinson

This commit is contained in:
David Sansome 2011-01-23 15:36:09 +00:00
parent d7c2e40a7a
commit fe818e5597
1 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include "librarywatcher.h"
#include "librarybackend.h"
#include "core/albumcoverloader.h"
#include "core/taskmanager.h"
#include "playlistparsers/cueparser.h"
@ -319,7 +320,9 @@ void LibraryWatcher::ScanSubdirectory(
// Also want to look to see whether the album art has changed
QString image = ImageForSong(file, album_art);
if ((matching_song.art_automatic().isEmpty() && !image.isEmpty()) ||
(!matching_song.art_automatic().isEmpty() && !QFile::exists(matching_song.art_automatic()))) {
(!matching_song.art_automatic().isEmpty()
&& matching_song.art_automatic() != AlbumCoverLoader::kEmbeddedCover
&& !QFile::exists(matching_song.art_automatic()))) {
changed = true;
}
@ -492,7 +495,12 @@ SongList LibraryWatcher::ScanNewFile(const QString& file, const QString& path,
void LibraryWatcher::PreserveUserSetData(const QString& file, const QString& image,
const Song& matching_song, Song* out, ScanTransaction* t) {
out->set_id(matching_song.id());
out->set_art_automatic(image);
// Previous versions of Clementine incorrectly overwrote this and
// stored it in the DB, so we can't rely on matching_song to
// know if it has embedded artwork or not, but we can check here.
if (out->art_automatic() != AlbumCoverLoader::kEmbeddedCover)
out->set_art_automatic(image);
out->set_playcount(matching_song.playcount());
out->set_skipcount(matching_song.skipcount());