Sayonara Player
MetaData.h
1 /* MetaData.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
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 3 of the License, or
10  * (at your option) 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /*
22  * MetaData.h
23  *
24  * Created on: Mar 10, 2011
25  * Author: Lucio Carreras
26  */
27 
28 #ifndef METADATA_H_
29 #define METADATA_H_
30 
31 #include "Utils/MetaData/LibraryItem.h"
32 #include "Utils/MetaData/RadioMode.h"
33 #include "Utils/MetaData/Genre.h"
34 #include "Utils/Library/Sortorder.h"
35 #include "Utils/SetFwd.h"
36 #include "Utils/Pimpl.h"
37 
38 #include <QMetaType>
39 #include <QString>
40 
41 class QStringList;
42 class Genre;
43 
48 class MetaData :
49  public LibraryItem
50 {
51  PIMPL(MetaData)
52 
53 public:
54  MilliSeconds length_ms;
55  Filesize filesize;
56 
57  TrackID id;
58  ArtistId artist_id;
59  AlbumId album_id;
60 
61  Bitrate bitrate;
62  uint16_t track_num;
63  uint16_t year;
64 
65  Disc discnumber;
66  Disc n_discs;
67 
68  LibraryId library_id;
69  Rating rating;
70 
71  bool played;
72  bool is_extern;
73  bool pl_playing;
74  bool is_disabled;
75 
76 public:
77  MetaData ();
78  explicit MetaData (const QString& path);
79  MetaData (const MetaData& );
80  MetaData ( MetaData&& );
81  MetaData& operator=(const MetaData& md);
82  MetaData& operator=(MetaData&& md);
83 
84  ~MetaData();
85 
86  const QString& title() const;
87  void set_title(const QString& title);
88 
89  const QString& artist() const;
90  void set_artist(const QString& artist);
91 
92  const QString& album() const;
93  void set_album(const QString& album);
94 
95  const QString& comment() const;
96  void set_comment(const QString& comment);
97 
98  QString filepath() const;
99  QString set_filepath(QString filepath);
100 
101  ArtistId album_artist_id() const;
102  const QString& album_artist() const;
103  bool has_album_artist() const;
104 
105  void set_album_artist(const QString& album_artist, ArtistId id=-1);
106  void set_album_artist_id(ArtistId id);
107 
108  void set_radio_station(const QString& name);
109  const QString& radio_station() const;
110 
111  RadioMode radio_mode() const;
112  bool is_valid() const;
113 
114  bool operator==(const MetaData& md) const;
115  bool operator!=(const MetaData& md) const;
116  bool is_equal(const MetaData& md) const;
117  bool is_equal_deep(const MetaData& md) const;
118 
119  const SP::Set<GenreID>& genre_ids() const;
120  SP::Set<Genre> genres() const;
121  bool has_genre(const Genre& genre) const;
122  bool remove_genre(const Genre& genre);
123  bool add_genre(const Genre& genre);
124  void set_genres(const SP::Set<Genre>& genres);
125  void set_genres(const QStringList& genres);
126 
127  QString genres_to_string() const;
128  QStringList genres_to_list() const;
129 
130  QString to_string() const;
131 
132  static QVariant toVariant(const MetaData& md);
133  static bool fromVariant(const QVariant& v, MetaData& md);
134 
135 private:
136  QHash<GenreID, Genre>& genre_pool() const;
137 };
138 
139 Q_DECLARE_METATYPE(MetaData)
140 
141 #endif /* METADATA_H_ */
The LibraryItem class.
Definition: LibraryItem.h:65
The MetaData class.
Definition: MetaData.h:48
RadioMode
The RadioMode enum.
Definition: RadioMode.h:30
Definition: Genre.h:29
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: AbstractPlaylist.h:38