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  SINGLETON(Manager)
50  PIMPL(Manager)
51 
52  public:
59 
65  QList<Url> artistAddresses(const QString& artist) const;
66 
73  QList<Url> albumAddresses(const QString& artist, const QString& album) const;
74 
80  QList<Url> searchAddresses(const QString& str) const;
81 
87  QList<Url> searchAddresses(const QString& str,
88  const QString& cover_fetcher_identifier) const;
89 
97 
103 
104  QList<Cover::Fetcher::Base*> activeCoverfetchers() const;
105  QList<Cover::Fetcher::Base*> inactiveCoverfetchers() const;
106 
107  bool isActive(const Cover::Fetcher::Base* cfi) const;
108  bool isActive(const QString& identifier) const;
109 
118  Url directFetcherUrl(const QString& url);
119 
120  Url websiteFetcherUrl(const QString& url);
121 
122  static bool isSearchstringWebsite(const QString& searchstring);
123 
124  private slots:
125  void serversChanged();
126  };
127 
128  }
129 }
130 #endif // COVERFETCHMANAGER_H
Cover::Fetcher::Manager::artistAddresses
QList< Url > artistAddresses(const QString &artist) const
get urls for a artist search query
Cover::Fetcher::Manager::searchAddresses
QList< Url > searchAddresses(const QString &str, const QString &cover_fetcher_identifier) const
get urls for a fuzzy query
QList
Definition: EngineUtils.h:33
Cover::Fetcher::Manager
Retrieve Download Urls for Cover Searcher. CoverFetcherInterface can be registered,...
Definition: CoverFetchManager.h:47
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:17
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:35
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...