Sayonara Player
CoverLocation.h
1 /* CoverLocation.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 #ifndef COVERLOCATION_H
22 #define COVERLOCATION_H
23 
24 #include <QMetaType>
25 #include "Helper/Pimpl.h"
26 
27 class QUrl;
28 class QString;
29 class QStringList;
30 class MetaData;
31 class Album;
32 class Artist;
38 {
39  PIMPL(CoverLocation)
40 
41 public:
42  CoverLocation();
43  ~CoverLocation();
44  CoverLocation(const CoverLocation& cl);
45  CoverLocation& operator=(const CoverLocation& cl);
46 
47  bool valid() const;
48  QStringList local_paths() const;
49  void add_local_path(const QString& path);
50  QString local_path(int idx) const;
51  QString cover_path() const;
52  QString identifer() const;
53  QStringList search_urls() const;
54  void remove_first_search_url();
55 
56  bool has_search_urls() const;
57  QString search_term() const;
58  void set_search_term(const QString& search_term);
59  QString to_string() const;
60 
61 
68  static CoverLocation get_cover_location(const QString& album_name, const QString& artist_name);
69 
77  static CoverLocation get_cover_location(const QString& album_name, const QStringList& artists);
78 
79 
86  static CoverLocation get_cover_location(const Album& album);
87 
88 
106  static CoverLocation get_cover_location(const QString& artist);
107 
108 
115  static CoverLocation get_cover_location(const Artist& artist);
116 
117 
127  static CoverLocation get_cover_location(const MetaData& md);
128 
129 
136  static CoverLocation get_cover_location(const QUrl& url, const QString& target_path);
137 
138 
144 
150  static bool isInvalidLocation(const QString& cover_path);
151 
152 
157  static QString get_cover_directory(const QString& append_path);
158 
159  QString preferred_path() const;
160 };
161 
162 Q_DECLARE_METATYPE(CoverLocation)
163 #endif // COVERLOCATION_H
static CoverLocation getInvalidLocation()
returns an invalid location
static bool isInvalidLocation(const QString &cover_path)
returns if path is the same as the invalid location path
The MetaData class MetaDataHelper.
Definition: MetaData.h:55
The CoverLocation class.
Definition: CoverLocation.h:37
The Album class.
Definition: Album.h:38
static CoverLocation get_cover_location(const QString &album_name, const QString &artist_name)
creates CoverLocation by taking the md5 sum between album_name and artist_name
The Artist class.
Definition: Artist.h:33
static QString get_cover_directory(const QString &append_path)
returns the standard cover directory