diff options
-rw-r--r-- | xbmc/music/infoscanner/MusicInfoScanner.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index e639de2d72..311cdc62ae 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -674,29 +674,32 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album } /* - We have a compilation if - 1. album name is non-empty AND - 2a. no tracks overlap OR - 2b. all tracks are marked as part of compilation AND - 3a. a unique primary artist is specified as "various" or "various artists" OR - 3b. we have at least two primary artists and no album artist specified. - */ + We have a Various Artists compilation if + 1. album name is non-empty AND + 2a. no tracks overlap OR + 2b. all tracks are marked as part of compilation AND + 3a. a unique primary artist is specified as "various", "various artists" or the localized value + OR + 3b. we have at least two primary artists and no album artist specified. + */ + std::string various = g_localizeStrings.Get(340); // Various Artists bool compilation = !songsByAlbumName->first.empty() && (isCompilation || !tracksOverlap); // 1+2b+2a if (artists.size() == 1) { std::string artist = artists.begin()->first; StringUtils::ToLower(artist); if (!StringUtils::EqualsNoCase(artist, "various") && - !StringUtils::EqualsNoCase(artist, "various artists")) // 3a + !StringUtils::EqualsNoCase(artist, "various artists") && + !StringUtils::EqualsNoCase(artist, various)) // 3a compilation = false; } else if (hasAlbumArtist) // 3b compilation = false; + //Such a compilation album is stored with the localized value for "various artists" as the album artist if (compilation) { CLog::Log(LOGDEBUG, "Album '%s' is a compilation as there's no overlapping tracks and %s", songsByAlbumName->first.c_str(), hasAlbumArtist ? "the album artist is 'Various'" : "there is more than one unique artist"); artists.clear(); - std::string various = g_localizeStrings.Get(340); // Various Artists std::vector<std::string> va; va.push_back(various); for (VECSONGS::iterator song = songs.begin(); song != songs.end(); ++song) { @@ -706,6 +709,21 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album } /* + We also have a compilation album when album name is non-empty and ALL tracks are marked as part of + a compilation even if an album artist is given, or all songs have the same primary artist. For + example an anthology - a collection of recordings from various old sources + combined together such as a "best of", retrospective or rarities type release. + + Such an anthology compilation will not have been caught by the previous tests as it fails 3a and 3b. + The album artist can be determined just like any normal album. + */ + if (!compilation && !songsByAlbumName->first.empty() && isCompilation) + { + compilation = true; + CLog::Log(LOGDEBUG, "Album '%s' is a compilation as all songs are marked aspart of a compilation", songsByAlbumName->first.c_str()); + } + + /* Step 3: Find the common albumartist for each song and assign albumartist to those tracks that don't have it set. */ |