aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaveTBlake <oak99sky@yahoo.co.uk>2015-10-20 12:07:28 +0100
committerDaveTBlake <oak99sky@yahoo.co.uk>2015-10-20 12:07:28 +0100
commitb588abbcbf11a3fec3795b1f8fb0807b2635320a (patch)
tree1eb5ef3b70af78c12518c5ff12bb488918f258e3
parent69b57787ee352a32d8f90152dd7d525adca053e0 (diff)
When artist credits has not been populated, because only song or album tables have been queried, build a vector of artist names by splitting the artist description string.
Note this is a temporary fix as splitting the string may not give the same artists as held in the song_artist or album_artist tables, so could lead to discrepencies. In particular in the json rpc using GetAlbums the array of artists for an album may not match the array of artistIds. This has been possible since processing of the ARTISTS tag was added. However it seems better to return artists, if sometimes they are out of alignment, than nothing.
-rw-r--r--xbmc/music/Album.cpp5
-rw-r--r--xbmc/music/Song.cpp6
2 files changed, 11 insertions, 0 deletions
diff --git a/xbmc/music/Album.cpp b/xbmc/music/Album.cpp
index 342751d6fe..866959e321 100644
--- a/xbmc/music/Album.cpp
+++ b/xbmc/music/Album.cpp
@@ -178,6 +178,11 @@ const std::vector<std::string> CAlbum::GetAlbumArtist() const
{
albumartists.push_back(artistCredit->GetArtist());
}
+ //When artist credits have not been populated attempt to build an artist vector from the descrpition string
+ //This is a tempory fix, in the longer term other areas should query the album_artist table and populate
+ //artist credits. Note that splitting the string may not give the same artists as held in the album_artist table
+ if (albumartists.empty() && !strArtistDesc.empty())
+ albumartists = StringUtils::Split(strArtistDesc, g_advancedSettings.m_musicItemSeparator);
return albumartists;
}
diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp
index cbb058b122..c03ae91a83 100644
--- a/xbmc/music/Song.cpp
+++ b/xbmc/music/Song.cpp
@@ -21,6 +21,7 @@
#include "Song.h"
#include "music/tags/MusicInfoTag.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "FileItem.h"
#include "settings/AdvancedSettings.h"
@@ -167,6 +168,11 @@ const std::vector<std::string> CSong::GetArtist() const
{
songartists.push_back(artistCredit->GetArtist());
}
+ //When artist credits have not been populated attempt to build an artist vector from the descrpition string
+ //This is a tempory fix, in the longer term other areas should query the song_artist table and populate
+ //artist credits. Note that splitting the string may not give the same artists as held in the song_artist table
+ if (songartists.empty() && !strArtistDesc.empty())
+ songartists = StringUtils::Split(strArtistDesc, g_advancedSettings.m_musicItemSeparator);
return songartists;
}