2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "XBDateTime.h"
12 #include "utils/ScraperUrl.h"
13 #include "utils/StringUtils.h"
29 std::string strReleaseGroupMBID
;
36 bool operator<(const CArtist
& a
) const
38 if (strMusicBrainzArtistID
.empty() && a
.strMusicBrainzArtistID
.empty())
40 if (strArtist
< a
.strArtist
) return true;
41 if (strArtist
> a
.strArtist
) return false;
45 if (strMusicBrainzArtistID
< a
.strMusicBrainzArtistID
) return true;
46 if (strMusicBrainzArtistID
> a
.strMusicBrainzArtistID
) return false;
50 void MergeScrapedArtist(const CArtist
& source
, bool override
= true);
58 strDisambiguation
.clear();
78 strLastScraped
.clear();
81 /*! \brief Load artist information from an XML file.
82 See CVideoInfoTag::Load for a description of the types of elements we load.
83 \param element the root XML element to parse.
84 \param append whether information should be added to the existing tag, or whether it should be reset first.
85 \param prioritise if appending, whether additive tags should be prioritised (i.e. replace or prepend) over existing values. Defaults to false.
86 \sa CVideoInfoTag::Load
88 bool Load(const TiXmlElement
*element
, bool append
= false, bool prioritise
= false);
89 bool Save(TiXmlNode
*node
, const std::string
&tag
, const std::string
& strPath
);
91 void SetDateAdded(const std::string
& strDateAdded
);
92 void SetDateUpdated(const std::string
& strDateUpdated
);
93 void SetDateNew(const std::string
& strDateNew
);
95 std::string strArtist
;
96 std::string strSortName
;
97 std::string strMusicBrainzArtistID
;
99 std::string strGender
;
100 std::string strDisambiguation
;
101 std::vector
<std::string
> genre
;
102 std::string strBiography
;
103 std::vector
<std::string
> styles
;
104 std::vector
<std::string
> moods
;
105 std::vector
<std::string
> instruments
;
107 std::string strFormed
;
109 std::string strDisbanded
;
110 std::vector
<std::string
> yearsActive
;
112 CScraperUrl thumbURL
; // Data for available remote art
113 std::map
<std::string
, std::string
> art
; // Current artwork - thumb, fanart etc.
114 std::vector
<CDiscoAlbum
> discography
;
115 CDateTime dateAdded
; // From related file creation or modification times, or when (re-)scanned
116 CDateTime dateUpdated
; // Time db record Last modified
117 CDateTime dateNew
; // Time db record created
118 bool bScrapedMBID
= false;
119 std::string strLastScraped
;
125 friend class CMusicDatabase
;
128 CArtistCredit() = default;
129 explicit CArtistCredit(std::string strArtist
) : m_strArtist(std::move(strArtist
)) {}
130 CArtistCredit(std::string strArtist
, std::string strMusicBrainzArtistID
)
131 : m_strArtist(std::move(strArtist
)), m_strMusicBrainzArtistID(std::move(strMusicBrainzArtistID
))
134 CArtistCredit(std::string strArtist
, std::string strSortName
, std::string strMusicBrainzArtistID
)
135 : m_strArtist(std::move(strArtist
)),
136 m_strSortName(std::move(strSortName
)),
137 m_strMusicBrainzArtistID(std::move(strMusicBrainzArtistID
))
141 bool operator<(const CArtistCredit
& a
) const
143 if (m_strMusicBrainzArtistID
.empty() && a
.m_strMusicBrainzArtistID
.empty())
145 if (m_strArtist
< a
.m_strArtist
) return true;
146 if (m_strArtist
> a
.m_strArtist
) return false;
150 if (m_strMusicBrainzArtistID
< a
.m_strMusicBrainzArtistID
) return true;
151 if (m_strMusicBrainzArtistID
> a
.m_strMusicBrainzArtistID
) return false;
155 std::string
GetArtist() const { return m_strArtist
; }
156 std::string
GetSortName() const { return m_strSortName
; }
157 std::string
GetMusicBrainzArtistID() const { return m_strMusicBrainzArtistID
; }
158 int GetArtistId() const { return idArtist
; }
159 bool HasScrapedMBID() const { return m_bScrapedMBID
; }
160 void SetArtist(const std::string
&strArtist
) { m_strArtist
= strArtist
; }
161 void SetSortName(const std::string
&strSortName
) { m_strSortName
= strSortName
; }
162 void SetMusicBrainzArtistID(const std::string
&strMusicBrainzArtistID
) { m_strMusicBrainzArtistID
= strMusicBrainzArtistID
; }
163 void SetArtistId(int idArtist
) { this->idArtist
= idArtist
; }
164 void SetScrapedMBID(bool scrapedMBID
) { this->m_bScrapedMBID
= scrapedMBID
; }
168 std::string m_strArtist
;
169 std::string m_strSortName
;
170 std::string m_strMusicBrainzArtistID
;
171 bool m_bScrapedMBID
= false; // Flag that mbid is from album merge of scarper results not derived from tags
174 typedef std::vector
<CArtist
> VECARTISTS
;
175 typedef std::vector
<CArtistCredit
> VECARTISTCREDITS
;
177 const std::string BLANKARTIST_FAKEMUSICBRAINZID
= "Artist Tag Missing";
178 const std::string BLANKARTIST_NAME
= "[Missing Tag]";
179 const int BLANKARTIST_ID
= 1;
180 const std::string VARIOUSARTISTS_MBID
= "89ad4ac3-39f7-470e-963a-56509c546377";
182 #define ROLE_ARTIST 1 //Default role
187 CMusicRole() = default;
188 CMusicRole(std::string strRole
, std::string strArtist
)
189 : idRole(-1), m_strRole(std::move(strRole
)), m_strArtist(std::move(strArtist
)), idArtist(-1)
192 CMusicRole(int role
, std::string strRole
, std::string strArtist
, int ArtistId
)
194 m_strRole(std::move(strRole
)),
195 m_strArtist(std::move(strArtist
)),
199 std::string
GetArtist() const { return m_strArtist
; }
200 std::string
GetRoleDesc() const { return m_strRole
; }
201 int GetRoleId() const { return idRole
; }
202 int GetArtistId() const { return idArtist
; }
203 void SetArtistId(int iArtistId
) { idArtist
= iArtistId
; }
205 bool operator==(const CMusicRole
& a
) const
207 if (StringUtils::EqualsNoCase(m_strRole
, a
.m_strRole
))
208 return StringUtils::EqualsNoCase(m_strArtist
, a
.m_strArtist
);
214 std::string m_strRole
;
215 std::string m_strArtist
;
219 typedef std::vector
<CMusicRole
> VECMUSICROLES
;