Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Music Scanner Update #1222

Merged
merged 1 commit into from Aug 5, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 18 additions & 12 deletions xbmc/music/infoscanner/MusicInfoScanner.cpp
Expand Up @@ -746,7 +746,8 @@ void CMusicInfoScanner::FindArtForAlbums(VECALBUMS &albums, const CStdString &pa
/*
Find art that is common across these items
If we find a single art image we treat it as the album art
else we keep everything as song art.
and discard song art else we use first as album art and
keep everything as song art.
*/
bool singleArt = true;
CSong *art = NULL;
Expand All @@ -764,23 +765,28 @@ void CMusicInfoScanner::FindArtForAlbums(VECALBUMS &albums, const CStdString &pa
art = &song;
}
}

/*
assign the first art found to the album - better than no art at all
*/

if (art && albumArt.empty())
{
if (!art->strThumb.empty())
albumArt = art->strThumb;
else
albumArt = CTextureCache::GetWrappedImageURL(art->strFileName, "music");
}

album.art["thumb"] = albumArt;

if (singleArt)
{ // a single piece of art was found for these songs so assign to the album
// and clear out of the songs
if (art && albumArt.empty())
{
if (!art->strThumb.empty())
albumArt = art->strThumb;
else
albumArt = CTextureCache::GetWrappedImageURL(art->strFileName, "music");
}
{ //if singleArt then we can clear the artwork for all songs
for (VECSONGS::iterator k = album.songs.begin(); k != album.songs.end(); ++k)
k->strThumb.clear();
album.art["thumb"] = albumArt;
}
else
{ // more than one piece of art was found for these songs, so cache per song
// and don't assign to the album
for (VECSONGS::iterator k = album.songs.begin(); k != album.songs.end(); ++k)
{
if (k->strThumb.empty() && !k->embeddedArt.empty())
Expand Down