Sayonara Player
CoverFetchManager.h
1 /* CoverFetchManager.h */
2 
3 /* Copyright (C) 2011-2019 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 COVERFETCHMANAGER_H
22 #define COVERFETCHMANAGER_H
23 
24 #include "Utils/Singleton.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QList>
28 #include <QObject>
29 
30 namespace Cover
31 {
32 namespace Fetcher
33 {
34  struct FetchUrl
35  {
36  bool active;
37  QString identifier;
38  QString url;
39 
40  FetchUrl()
41  {
42  active=false;
43  identifier=QString();
44  url=QString();
45  }
46 
47  FetchUrl(bool active, const QString& identifier, const QString& url) :
48  active(active), identifier(identifier), url(url)
49  {}
50  };
51 
52  class Base;
61  class Manager :
62  public QObject
63  {
64  Q_OBJECT
65 
66  SINGLETON(Manager)
67  PIMPL(Manager)
68 
69  public:
76 
77 
83  QList<FetchUrl> artist_addresses(const QString& artist, bool also_inactive) const;
84 
91  QList<FetchUrl> album_addresses(const QString& artist, const QString& album, bool also_inactive) const;
92 
98  QList<FetchUrl> search_addresses(const QString& str, bool also_inactive) const;
99 
100 
106  QList<FetchUrl> search_addresses(const QString& str,
107  const QString& cover_fetcher_identifier, bool also_inactive) const;
108 
114  Cover::Fetcher::Base* coverfetcher(const QString& url) const;
115 
121 
122  QList<Cover::Fetcher::Base*> active_coverfetchers() const;
123  QList<Cover::Fetcher::Base*> inactive_coverfetchers() const;
124 
125  bool is_active(const Cover::Fetcher::Base* cfi) const;
126  bool is_active(const QString& identifier) const;
127 
128  QString identifier_by_url(const QString& url) const;
129 
130 
131  private slots:
132  void servers_changed();
133  };
134 
135 }
136 }
137 #endif // COVERFETCHMANAGER_H
Definition: CoverFetchManager.h:34
The CoverFetcherInterface interface.
Definition: CoverFetcherInterface.h:36
void register_coverfetcher(Cover::Fetcher::Base *t)
Register a cover fetcher. Per default there is one for Discogs, last.fm and Google.
Retrieve Download Urls for Cover Searcher. CoverFetcherInterface can be registered,...
Definition: CoverFetchManager.h:61
QList< FetchUrl > search_addresses(const QString &str, bool also_inactive) const
get urls for a fuzzy query
QList< FetchUrl > artist_addresses(const QString &artist, bool also_inactive) const
get urls for a artist search query
QList< FetchUrl > album_addresses(const QString &artist, const QString &album, bool also_inactive) const
get urls for a album search query
Cover::Fetcher::Base * coverfetcher(const QString &url) const
get a CoverFetcherInterface by a specific url
QList< Cover::Fetcher::Base * > coverfetchers() const
fetches all available cover fetcher
Definition: org_mpris_media_player2_adaptor.h:20