xbmc
Album.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
16 #include "Artist.h"
17 #include "Song.h"
18 #include "XBDateTime.h"
19 #include "utils/ScraperUrl.h"
20 
21 #include <map>
22 #include <vector>
23 
24 class TiXmlNode;
25 class CFileItem;
26 class CAlbum
27 {
28 public:
29  explicit CAlbum(const CFileItem& item);
30  CAlbum() = default;
31  bool operator<(const CAlbum &a) const;
32  void MergeScrapedAlbum(const CAlbum& album, bool override = true);
33 
34  void Reset()
35  {
36  idAlbum = -1;
37  strAlbum.clear();
38  strMusicBrainzAlbumID.clear();
39  strReleaseGroupMBID.clear();
40  artistCredits.clear();
41  strArtistDesc.clear();
42  strArtistSort.clear();
43  genre.clear();
44  thumbURL.Clear();
45  moods.clear();
46  styles.clear();
47  themes.clear();
48  art.clear();
49  strReview.clear();
50  strLabel.clear();
51  strType.clear();
52  strReleaseStatus.clear();
53  strPath.clear();
54  fRating = -1;
55  iUserrating = -1;
56  iVotes = -1;
57  strOrigReleaseDate.clear();
58  strReleaseDate.clear();
59  bCompilation = false;
60  bBoxedSet = false;
61  iTimesPlayed = 0;
62  dateAdded.Reset();
63  dateUpdated.Reset();
64  dateNew.Reset();
65  lastPlayed.Reset();
66  iTotalDiscs = -1;
67  songs.clear();
68  releaseType = Album;
69  strLastScraped.clear();
70  bScrapedMBID = false;
71  bArtistSongMerge = false;
72  iAlbumDuration = 0;
73  }
74 
78  const std::vector<std::string> GetAlbumArtist() const;
79 
83  const std::vector<std::string> GetMusicBrainzAlbumArtistID() const;
84  std::string GetGenreString() const;
85 
90  const std::string GetAlbumArtistString() const;
91 
96  const std::string GetAlbumArtistSort() const;
97 
101  const std::vector<int> GetArtistIDArray() const;
102 
103  typedef enum ReleaseType {
104  Album = 0,
105  Single
106  } ReleaseType;
107 
108  std::string GetReleaseType() const;
109  void SetReleaseType(const std::string& strReleaseType);
110  void SetDateAdded(const std::string& strDateAdded);
111  void SetDateUpdated(const std::string& strDateUpdated);
112  void SetDateNew(const std::string& strDateNew);
113  void SetLastPlayed(const std::string& strLastPlayed);
114 
115  static std::string ReleaseTypeToString(ReleaseType releaseType);
116  static ReleaseType ReleaseTypeFromString(const std::string& strReleaseType);
117 
128  void SetArtistCredits(const std::vector<std::string>& names, const std::vector<std::string>& hints,
129  const std::vector<std::string>& mbids,
130  const std::vector<std::string>& artistnames = std::vector<std::string>(),
131  const std::vector<std::string>& artisthints = std::vector<std::string>(),
132  const std::vector<std::string>& artistmbids = std::vector<std::string>());
133 
141  bool Load(const TiXmlElement *element, bool append = false, bool prioritise = false);
142  bool Save(TiXmlNode *node, const std::string &tag, const std::string& strPath);
143 
144  int idAlbum = -1;
145  std::string strAlbum;
146  std::string strMusicBrainzAlbumID;
147  std::string strReleaseGroupMBID;
148  std::string strArtistDesc;
149  std::string strArtistSort;
150  VECARTISTCREDITS artistCredits;
151  std::vector<std::string> genre;
152  CScraperUrl thumbURL;
153  std::vector<std::string> moods;
154  std::vector<std::string> styles;
155  std::vector<std::string> themes;
156  std::map<std::string, std::string> art;
157  std::string strReview;
158  std::string strLabel;
159  std::string strType;
160  std::string strReleaseStatus;
161  std::string strPath;
162  float fRating = -1;
163  int iUserrating = -1;
164  int iVotes = -1;
165  std::string strReleaseDate;
166  std::string strOrigReleaseDate;
167  bool bBoxedSet = false;
168  bool bCompilation = false;
169  int iTimesPlayed = 0;
170  CDateTime dateAdded; // From related file creation or modification times, or when (re-)scanned
171  CDateTime dateUpdated; // Time db record Last modified
172  CDateTime dateNew; // Time db record created
173  CDateTime lastPlayed;
174  int iTotalDiscs = -1;
176  ReleaseType releaseType = Album;
177  std::string strLastScraped;
178  bool bScrapedMBID = false;
179  bool bArtistSongMerge = false;
180  int iAlbumDuration = 0;
181 };
182 
183 typedef std::vector<CAlbum> VECALBUMS;
const std::string GetAlbumArtistSort() const
Get album artist sort name from the artist sort string (if it exists) or concatenated from the vector...
Definition: Album.cpp:382
void SetArtistCredits(const std::vector< std::string > &names, const std::vector< std::string > &hints, const std::vector< std::string > &mbids, const std::vector< std::string > &artistnames=std::vector< std::string >(), const std::vector< std::string > &artisthints=std::vector< std::string >(), const std::vector< std::string > &artistmbids=std::vector< std::string >())
Set album artist credits using the arrays of tag values. If strArtistSort (as from ALBUMARTISTSORT ta...
Definition: Album.cpp:64
const std::string GetAlbumArtistString() const
Get album artist names from the artist description string (if it exists) or concatenated from the vec...
Definition: Album.cpp:367
const std::vector< std::string > GetMusicBrainzAlbumArtistID() const
Get album artist MusicBrainz IDs from the vector of artistcredits objects.
Definition: Album.cpp:356
std::vector< CSong > VECSONGS
A vector of CSong objects, used for CMusicDatabase.
Definition: Song.h:212
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
Definition: Album.h:26
VECSONGS songs
Local songs.
Definition: Album.h:175
bool Load(const TiXmlElement *element, bool append=false, bool prioritise=false)
Load album information from an XML file. See CVideoInfoTag::Load for a description of the types of el...
Definition: Album.cpp:478
const std::vector< std::string > GetAlbumArtist() const
Get album artist names from the vector of artistcredits objects.
Definition: Album.cpp:345
const std::vector< int > GetArtistIDArray() const
Get album artist IDs (for json rpc) from the vector of artistcredits objects.
Definition: Album.cpp:398
Represents a file on a share.
Definition: FileItem.h:102
Definition: ScraperUrl.h:21