Fix keymap.
[vuplus_xbmc] / xbmc / music / Artist.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include <map>
24 #include <vector>
25
26 #include "utils/ScraperUrl.h"
27 #include "utils/Fanart.h"
28
29 class TiXmlNode;
30 class CAlbum;
31 class CMusicDatabase;
32
33 class CArtist
34 {
35 public:
36   long idArtist;
37   bool operator<(const CArtist& a) const
38   {
39     if (strMusicBrainzArtistID.empty() && a.strMusicBrainzArtistID.empty())
40     {
41       if (strArtist < a.strArtist) return true;
42       if (strArtist > a.strArtist) return false;
43       return false;
44     }
45
46     if (strMusicBrainzArtistID < a.strMusicBrainzArtistID) return true;
47     if (strMusicBrainzArtistID > a.strMusicBrainzArtistID) return false;
48     return false;
49   }
50   
51   void MergeScrapedArtist(const CArtist& source, bool override = true);
52
53   void Reset()
54   {
55     strArtist.clear();
56     genre.clear();
57     strBiography.clear();
58     styles.clear();
59     moods.clear();
60     instruments.clear();
61     strBorn.clear();
62     strFormed.clear();
63     strDied.clear();
64     strDisbanded.clear();
65     yearsActive.clear();
66     thumbURL.Clear();
67     discography.clear();
68     idArtist = -1;
69     strPath.clear();
70   }
71
72   /*! \brief Load artist information from an XML file.
73    See CVideoInfoTag::Load for a description of the types of elements we load.
74    \param element    the root XML element to parse.
75    \param append     whether information should be added to the existing tag, or whether it should be reset first.
76    \param prioritise if appending, whether additive tags should be prioritised (i.e. replace or prepend) over existing values. Defaults to false.
77    \sa CVideoInfoTag::Load
78    */
79   bool Load(const TiXmlElement *element, bool append = false, bool prioritise = false);
80   bool Save(TiXmlNode *node, const CStdString &tag, const CStdString& strPath);
81
82   CStdString strArtist;
83   CStdString strMusicBrainzArtistID;
84   std::vector<std::string> genre;
85   CStdString strBiography;
86   std::vector<std::string> styles;
87   std::vector<std::string> moods;
88   std::vector<std::string> instruments;
89   CStdString strBorn;
90   CStdString strFormed;
91   CStdString strDied;
92   CStdString strDisbanded;
93   std::vector<std::string> yearsActive;
94   CStdString strPath;
95   CScraperUrl thumbURL;
96   CFanart fanart;
97   std::vector<std::pair<CStdString,CStdString> > discography;
98 };
99
100 class CArtistCredit
101 {
102   friend class CAlbum;
103   friend class CMusicDatabase;
104
105 public:
106   CArtistCredit() { }
107   CArtistCredit(std::string strArtist, std::string strJoinPhrase) : m_strArtist(strArtist), m_strJoinPhrase(strJoinPhrase), m_boolFeatured(false) { }
108   CArtistCredit(std::string strArtist, std::string strMusicBrainzArtistID, std::string strJoinPhrase)
109   : m_strArtist(strArtist), m_strMusicBrainzArtistID(strMusicBrainzArtistID), m_strJoinPhrase(strJoinPhrase), m_boolFeatured(false)  {  }
110   bool operator<(const CArtistCredit& a) const
111   {
112     if (m_strMusicBrainzArtistID.empty() && a.m_strMusicBrainzArtistID.empty())
113     {
114       if (m_strArtist < a.m_strArtist) return true;
115       if (m_strArtist > a.m_strArtist) return false;
116       return false;
117     }
118
119     if (m_strMusicBrainzArtistID < a.m_strMusicBrainzArtistID) return true;
120     if (m_strMusicBrainzArtistID > a.m_strMusicBrainzArtistID) return false;
121     return false;
122   }
123
124   std::string GetArtist() const                { return m_strArtist; }
125   std::string GetMusicBrainzArtistID() const   { return m_strMusicBrainzArtistID; }
126   std::string GetJoinPhrase() const            { return m_strJoinPhrase; }
127   int         GetArtistId() const              { return idArtist; }
128   void SetArtist(const std::string &strArtist) { m_strArtist = strArtist; }
129   void SetMusicBrainzArtistID(const std::string &strMusicBrainzArtistID) { m_strMusicBrainzArtistID = strMusicBrainzArtistID; }
130   void SetJoinPhrase(const std::string &strJoinPhrase) { m_strJoinPhrase = strJoinPhrase; }
131   void SetArtistId(int idArtist)               { this->idArtist = idArtist; }
132
133 private:
134   long idArtist;
135   std::string m_strArtist;
136   std::string m_strMusicBrainzArtistID;
137   std::string m_strJoinPhrase;
138   bool m_boolFeatured;
139 };
140
141 typedef std::vector<CArtist> VECARTISTS;
142 typedef std::vector<CArtistCredit> VECARTISTCREDITS;
143