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 
22 
23 #ifndef COVERFETCHMANAGER_H
24 #define COVERFETCHMANAGER_H
25 
26 #include "Utils/Singleton.h"
27 #include "Utils/Pimpl.h"
28 
29 #include <QList>
30 #include <QObject>
31 
32 namespace Cover
33 {
34 namespace Fetcher
35 {
36 
37  class Base;
46  class Manager :
47  public QObject
48  {
49  Q_OBJECT
50 
51  SINGLETON(Manager)
52  PIMPL(Manager)
53 
54  public:
61 
62 
68  QStringList artist_addresses(const QString& artist) const;
69 
76  QStringList album_addresses(const QString& artist, const QString& album) const;
77 
83  QStringList search_addresses(const QString& str) const;
84 
85 
91  QStringList search_addresses(const QString& str,
92  const QString& cover_fetcher_identifier) const;
93 
99  Cover::Fetcher::Base* coverfetcher(const QString& url) const;
100 
106 
107  QList<Cover::Fetcher::Base*> active_coverfetchers() const;
108  QList<Cover::Fetcher::Base*> inactive_coverfetchers() const;
109 
110  bool is_active(const Cover::Fetcher::Base* cfi) const;
111  bool is_active(const QString& identifier) const;
112 
113  QString identifier_by_url(const QString& url) const;
114 
115 
116  private slots:
117  void servers_changed();
118  };
119 
120 }
121 }
122 #endif // COVERFETCHMANAGER_H
QStringList search_addresses(const QString &str) const
get urls for a fuzzy query
The CoverFetcherInterface interface.
Definition: CoverFetcherInterface.h:39
QStringList album_addresses(const QString &artist, const QString &album) const
get urls for a album search query
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, so for example a last.fm cover fetcher via the register_cover_fetcher method. A specific CoverFetcherInterface may be retrieved by using the get_coverfetcher method.
Definition: CoverFetchManager.h:46
Cover::Fetcher::Base * coverfetcher(const QString &url) const
get a CoverFetcherInterface by a specific url
Definition: SomaFMStation.h:33
QList< Cover::Fetcher::Base * > coverfetchers() const
fetches all available cover fetcher
QStringList artist_addresses(const QString &artist) const
get urls for a artist search query
Definition: org_mpris_media_player2_adaptor.h:20