Skip to content

Commit

Permalink
Archive artistDesc and albumArtistDesc otherwise artist names not sho…
Browse files Browse the repository at this point in the history
…wn when album list loaded from cache.

Ensure that artistDesc and albumArtistDesc are set from vector when tags scanned.
  • Loading branch information
DaveTBlake committed Nov 24, 2015
1 parent 7e6c22a commit 041d3ad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions xbmc/music/tags/MusicInfoTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ void CMusicInfoTag::SetArtist(const std::string& strArtist)
}
}

void CMusicInfoTag::SetArtist(const std::vector<std::string>& artists)
void CMusicInfoTag::SetArtist(const std::vector<std::string>& artists, bool FillDesc /* = false*/)
{
m_artist = artists;
if (m_strArtistDesc.empty())
if (m_strArtistDesc.empty() || FillDesc)
{
SetArtistDesc(StringUtils::Join(artists, g_advancedSettings.m_musicItemSeparator));
}
Expand Down Expand Up @@ -381,10 +381,10 @@ void CMusicInfoTag::SetAlbumArtist(const std::string& strAlbumArtist)
}
}

void CMusicInfoTag::SetAlbumArtist(const std::vector<std::string>& albumArtists)
void CMusicInfoTag::SetAlbumArtist(const std::vector<std::string>& albumArtists, bool FillDesc /* = false*/)
{
m_albumArtist = albumArtists;
if (m_strAlbumArtistDesc.empty())
if (m_strAlbumArtistDesc.empty() || FillDesc)
SetAlbumArtistDesc(StringUtils::Join(albumArtists, g_advancedSettings.m_musicItemSeparator));
}

Expand Down Expand Up @@ -764,8 +764,10 @@ void CMusicInfoTag::Archive(CArchive& ar)
ar << m_strURL;
ar << m_strTitle;
ar << m_artist;
ar << m_strArtistDesc;
ar << m_strAlbum;
ar << m_albumArtist;
ar << m_strAlbumArtistDesc;
ar << m_genre;
ar << m_iDuration;
ar << m_iTrack;
Expand Down Expand Up @@ -797,8 +799,10 @@ void CMusicInfoTag::Archive(CArchive& ar)
ar >> m_strURL;
ar >> m_strTitle;
ar >> m_artist;
ar >> m_strArtistDesc;
ar >> m_strAlbum;
ar >> m_albumArtist;
ar >> m_strAlbumArtistDesc;
ar >> m_genre;
ar >> m_iDuration;
ar >> m_iTrack;
Expand Down
4 changes: 2 additions & 2 deletions xbmc/music/tags/MusicInfoTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ class CMusicInfoTag : public IArchivable, public ISerializable, public ISortable
void SetURL(const std::string& strURL);
void SetTitle(const std::string& strTitle);
void SetArtist(const std::string& strArtist);
void SetArtist(const std::vector<std::string>& artists);
void SetArtist(const std::vector<std::string>& artists, bool FillDesc = false);
void SetArtistDesc(const std::string& strArtistDesc);
void SetAlbum(const std::string& strAlbum);
void SetAlbumId(const int iAlbumId);
void SetAlbumArtist(const std::string& strAlbumArtist);
void SetAlbumArtist(const std::vector<std::string>& albumArtists);
void SetAlbumArtist(const std::vector<std::string>& albumArtists, bool FillDesc = false);
void SetAlbumArtistDesc(const std::string& strAlbumArtistDesc);
void SetGenre(const std::string& strGenre);
void SetGenre(const std::vector<std::string>& genres);
Expand Down
8 changes: 6 additions & 2 deletions xbmc/music/tags/TagLoaderTagLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,9 @@ void CTagLoaderTagLib::SetArtist(CMusicInfoTag &tag, const std::vector<std::stri
if (values.size() == 1)
tag.SetArtist(values[0]);
else
tag.SetArtist(values);
// Fill both artist vector and artist desc from tag value.
// Note desc may not be empty as it could have been set by previous parsing of ID3v2 before APE
tag.SetArtist(values, true);
}

const std::vector<std::string> CTagLoaderTagLib::SplitMBID(const std::vector<std::string> &values)
Expand Down Expand Up @@ -761,7 +763,9 @@ void CTagLoaderTagLib::SetAlbumArtist(CMusicInfoTag &tag, const std::vector<std:
if (values.size() == 1)
tag.SetAlbumArtist(values[0]);
else
tag.SetAlbumArtist(values);
// Fill both artist vector and artist desc from tag value.
// Note desc may not be empty as it could have been set by previous parsing of ID3v2 before APE
tag.SetAlbumArtist(values, true);
}

void CTagLoaderTagLib::SetGenre(CMusicInfoTag &tag, const std::vector<std::string> &values)
Expand Down

0 comments on commit 041d3ad

Please sign in to comment.