From b588abbcbf11a3fec3795b1f8fb0807b2635320a Mon Sep 17 00:00:00 2001 From: DaveTBlake Date: Tue, 20 Oct 2015 12:07:28 +0100 Subject: 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. --- xbmc/music/Album.cpp | 5 +++++ xbmc/music/Song.cpp | 6 ++++++ 2 files changed, 11 insertions(+) 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 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 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; } -- cgit v1.2.3