Skip to content
This repository
Browse code

musicdb: add strAlbumArtists to songview for fast retrieval

  • Loading branch information...
commit 7a5120222de1d6acf9b55bfe9b601f6b45700ceb 1 parent f8b9eea
Sascha Montellese authored November 27, 2012
5  xbmc/music/MusicDatabase.cpp
@@ -225,7 +225,8 @@ void CMusicDatabase::CreateViews()
225 225
               "  strMusicBrainzTRMID, iTimesPlayed, iStartOffset, iEndOffset, lastplayed,"
226 226
               "  rating, comment, song.idAlbum AS idAlbum, strAlbum, strPath,"
227 227
               "  iKaraNumber, iKaraDelay, strKaraEncoding,"
228  
-              "  album.bCompilation AS bCompilation "
  228
+              "  album.bCompilation AS bCompilation,"
  229
+              "  album.strArtists AS strAlbumArtists "
229 230
               "FROM song"
230 231
               "  JOIN album ON"
231 232
               "    song.idAlbum=album.idAlbum"
@@ -912,6 +913,7 @@ CSong CMusicDatabase::GetSongFromDataset(bool bWithMusicDbPath/*=false*/)
912 913
   song.strKaraokeLyrEncoding = m_pDS->fv(song_strKarEncoding).get_asString();
913 914
   song.iKaraokeDelay = m_pDS->fv(song_iKarDelay).get_asInt();
914 915
   song.bCompilation = m_pDS->fv(song_bCompilation).get_asInt() == 1;
  916
+  song.albumArtist = StringUtils::Split(m_pDS->fv(song_strAlbumArtists).get_asString(), g_advancedSettings.m_musicItemSeparator);
915 917
 
916 918
   // Get filename with full path
917 919
   if (!bWithMusicDbPath)
@@ -964,6 +966,7 @@ void CMusicDatabase::GetFileItemFromDataset(const dbiplus::sql_record* const rec
964 966
   URIUtils::AddFileToFolder(record->at(song_strPath).get_asString(), record->at(song_strFileName).get_asString(), strRealPath);
965 967
   item->GetMusicInfoTag()->SetURL(strRealPath);
966 968
   item->GetMusicInfoTag()->SetCompilation(record->at(song_bCompilation).get_asInt() == 1);
  969
+  item->GetMusicInfoTag()->SetAlbumArtist(record->at(song_strAlbumArtists).get_asString());
967 970
   item->GetMusicInfoTag()->SetLoaded(true);
968 971
   // Get filename with full path
969 972
   if (strMusicDBbasePath.IsEmpty())
5  xbmc/music/MusicDatabase.h
@@ -281,7 +281,7 @@ class CMusicDatabase : public CDatabase
281 281
   std::map<CStdString, CAlbum> m_albumCache;
282 282
 
283 283
   virtual bool CreateTables();
284  
-  virtual int GetMinVersion() const { return 30; };
  284
+  virtual int GetMinVersion() const { return 31; };
285 285
   const char *GetBaseDBName() const { return "MyMusic"; };
286 286
 
287 287
   int AddSong(const CSong& song, bool bCheck = true, int idAlbum = -1);
@@ -353,7 +353,8 @@ class CMusicDatabase : public CDatabase
353 353
     song_iKarNumber,
354 354
     song_iKarDelay,
355 355
     song_strKarEncoding,
356  
-    song_bCompilation
  356
+    song_bCompilation,
  357
+    song_strAlbumArtists
357 358
   } SongFields;
358 359
 
359 360
   // Fields should be ordered as they

0 notes on commit 7a51202

Please sign in to comment.
Something went wrong with that request. Please try again.