Sayonara Player
CoverFetchManager.h
1 /* CoverFetchManager.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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  class Base;
35  class Url;
36 
45  class Manager :
46  public QObject
47  {
48  Q_OBJECT
49 
50  SINGLETON(Manager)
51  PIMPL(Manager)
52 
53  public:
60 
61 
67  QList<Url> artistAddresses(const QString& artist) const;
68 
75  QList<Url> albumAddresses(const QString& artist, const QString& album) const;
76 
82  QList<Url> searchAddresses(const QString& str) const;
83 
84 
90  QList<Url> searchAddresses(const QString& str,
91  const QString& cover_fetcher_identifier) const;
92 
99  Cover::Fetcher::Base* coverfetcher(const Url& url) const;
100 
106 
107  QList<Cover::Fetcher::Base*> activeCoverfetchers() const;
108  QList<Cover::Fetcher::Base*> inactiveCoverfetchers() const;
109 
110  bool isActive(const Cover::Fetcher::Base* cfi) const;
111  bool isActive(const QString& identifier) const;
112 
113 
122  Url directFetcherUrl(const QString& url);
123 
124  static bool isSearchstringWebsite(const QString& searchstring);
125 
126 
127  private slots:
128  void serversChanged();
129  };
130 
131 }
132 }
133 #endif // COVERFETCHMANAGER_H
Cover::Fetcher::Manager::artistAddresses
QList< Url > artistAddresses(const QString &artist) const
get urls for a artist search query
QList
Definition: EngineUtils.h:33
Cover::Fetcher::Manager
Retrieve Download Urls for Cover Searcher. CoverFetcherInterface can be registered,...
Definition: CoverFetchManager.h:45
Cover::Fetcher::Manager::coverfetchers
QList< Cover::Fetcher::Base * > coverfetchers() const
fetches all available cover fetcher
Cover::Fetcher::Url
An Url is defined by its identifier and a custom url string. The identifier is the same as being used...
Definition: CoverFetcherUrl.h:16
Cover::Fetcher::Manager::albumAddresses
QList< Url > albumAddresses(const QString &artist, const QString &album) const
get urls for a album search query
Cover::Fetcher::Manager::searchAddresses
QList< Url > searchAddresses(const QString &str) const
get urls for a fuzzy query
Cover::Fetcher::Base
The CoverFetcherInterface interface.
Definition: CoverFetcher.h:34
Cover::Fetcher::Manager::registerCoverFetcher
void registerCoverFetcher(Cover::Fetcher::Base *t)
Register a cover fetcher. Per default there is one for Discogs, last.fm and Google.
Cover::Fetcher::Manager::coverfetcher
Cover::Fetcher::Base * coverfetcher(const Url &url) const
get a CoverFetcherInterface by a specific url
Cover::Fetcher::Manager::directFetcherUrl
Url directFetcherUrl(const QString &url)
If the LibraryItem has a reference to a cover download url an appropriate Url object can be retrieved...