[musicdb] fix: fix support for .nfos and better handling for scrapers that don't...
authornight199uk <night199uk@xbmc.org>
Sat, 16 Nov 2013 15:26:54 +0000 (23:26 +0800)
committernight199uk <night199uk@xbmc.org>
Sat, 16 Nov 2013 15:26:54 +0000 (23:26 +0800)
The real underlying cause here is the change in the structure of the .nfo files.
That should be documented so folks start to update their .nfos and other scrapers.

xbmc/music/Album.cpp

index d7a5259..3580901 100644 (file)
@@ -158,6 +158,19 @@ bool CAlbum::Load(const TiXmlElement *album, bool append, bool prioritise)
     albumArtistCreditsNode = albumArtistCreditsNode->NextSiblingElement("albumArtistCredits");
   }
 
+  // Support old style <artist></artist> for backwards compatibility
+  // .nfo files should ideally be updated to use the artist credits structure above
+  // or removed entirely in preference for better tags (MusicBrainz?)
+  if (artistCredits.empty() && !artist.empty())
+  {
+    for (vector<string>::const_iterator it = artist.begin(); it != artist.end(); ++it)
+    {
+      CArtistCredit artistCredit(*it, StringUtils::EmptyString,
+                                 it == --artist.end() ? StringUtils::EmptyString : g_advancedSettings.m_musicItemSeparator);
+      artistCredits.push_back(artistCredit);
+    }
+  }
+
   const TiXmlElement* node = album->FirstChildElement("track");
   if (node)
     songs.clear();  // this means that the tracks can't be spread over separate pages