Sayonara Player
CoverLookup.h
1 /* CoverLookup.h */
2 
3 /* Copyright (C) 2011-2016 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 /*
23  * CoverLookup.h
24  *
25  * Created on: Apr 4, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef COVERLOOKUP_H_
30 #define COVERLOOKUP_H_
31 
32 #include <QThread>
33 #include <QPixmap>
34 #include <QDir>
35 
36 #include <memory>
37 
38 class Album;
39 class Artist;
40 class CoverLocation;
45 class CoverLookupInterface : public QObject{
46 
47  Q_OBJECT
48 
49 signals:
50  void sig_cover_found(const CoverLocation&);
51  void sig_finished(bool);
52 
53 public slots:
54  virtual void stop()=0;
55 
56 public:
57  CoverLookupInterface(QObject* parent=nullptr);
58 
59 };
60 
66 
67  Q_OBJECT
68 
69 
70 private slots:
75  void cover_found(const CoverLocation& cl);
76 
80  void finished(bool);
81 
82 
83 public:
84 
85 
86  CoverLookup(QObject* parent=nullptr, int n_covers=1);
87  virtual ~CoverLookup();
88 
97  bool fetch_cover(const CoverLocation& cl);
98 
105  bool fetch_album_cover_standard(const QString& artist, const QString& album_name);
106 
113  bool fetch_album_cover_sampler(const QStringList& artists, const QString& album_name);
114 
120  bool fetch_album_cover(const Album& album);
121 
128  bool fetch_album_cover_by_id(int album_id, quint8 db_id);
129 
135  bool fetch_artist_cover_standard(const QString& artist);
136 
142  bool fetch_artist_cover(const Artist& artist);
143 
144 
151  bool fetch_cover_by_searchstring(const QString& searchstring, const QString& target_name);
152 
156  void emit_standard_cover();
157 
158 
162  void stop() override;
163 
164 
165 private:
166 
167  int _n_covers;
168 
173  void start_new_thread(const CoverLocation& cl);
174 };
175 
180 typedef std::shared_ptr<CoverLookup> CoverLookupPtr;
181 
182 #endif /* COVERLOOKUP_H_ */
The CoverLookupInterface class.
Definition: CoverLookup.h:45
The CoverLocation class.
Definition: CoverLocation.h:37
The Album class.
Definition: Album.h:41
The Artist class.
Definition: Artist.h:36
The CoverLookup class.
Definition: CoverLookup.h:65
std::shared_ptr< CoverLookup > CoverLookupPtr
CoverLookupPtr.
Definition: CoverLookup.h:180