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 "Helper/MetaData/LibraryItem.h"
32 #include "Helper/Set.h"
33 
34 #include <QMetaType>
35 #include <QStringList>
36 
37 
42 enum class RadioMode : quint8
43 {
44  Off = 0,
45  Station,
46  Soundcloud
47 };
48 
49 class Genre;
50 
55 class MetaData :
56  public LibraryItem
57 {
58 private:
59  QString _filepath;
60  RadioMode _radio_mode;
61 
62  qint32 _album_artist_id;
63  QString _album_artist;
64 
65 public:
66  qint32 id;
67  QString title;
68 
69  qint32 artist_id;
70  QString artist;
71 
72  qint32 album_id;
73  QString album; // if radio station: name of radio station
74 
75  SP::Set<Genre> genres;
76  quint8 rating;
77  quint64 length_ms;
78  quint16 year;
79 
80  quint16 track_num;
81  quint32 bitrate;
82  quint64 filesize;
83 
84  quint8 discnumber;
85  quint8 n_discs;
86 
87  bool played;
88  bool is_extern;
89  bool pl_playing;
90  bool is_disabled;
91 
92  MetaData ();
93  MetaData (const MetaData& );
94  MetaData ( MetaData&& );
95 
96  explicit MetaData (const QString& path);
97  ~MetaData();
98 
99  QUrl url() const;
100  QString filepath() const;
101  QString set_filepath(QString filepath);
102 
103  qint32 album_artist_id() const;
104  QString album_artist() const;
105  bool has_album_artist() const;
106 
107  void set_album_artist(const QString& album_artist, qint32 id=-1);
108  void set_album_artist_id(qint32 id);
109 
110  RadioMode radio_mode() const;
111 
112  MetaData& operator=(const MetaData& md);
113  bool operator==(const MetaData& md) const;
114  bool operator!=(const MetaData& md) const;
115  bool is_equal(const MetaData& md) const;
116  bool is_equal_deep(const MetaData& md) const;
117 
118  bool has_genre(const Genre& genre) const;
119  bool remove_genre(const Genre& genre);
120  bool add_genre(const Genre& genre);
121  void set_genres(const QStringList& genres);
122  QString genres_to_string() const;
123  QStringList genres_to_list() const;
124 
125  QString to_string() const;
126 
127  static QVariant toVariant(const MetaData& md);
128  static bool fromVariant(const QVariant& v, MetaData& md);
129 };
130 
131 Q_DECLARE_METATYPE(MetaData)
132 
133 
134 #endif /* METADATA_H_ */
The LibraryItem class.
Definition: LibraryItem.h:56
RadioMode
The RadioMode enum.
Definition: MetaData.h:42
The MetaData class MetaDataHelper.
Definition: MetaData.h:55
Definition: Genre.h:29