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
30namespace Cover
31{
32 namespace Fetcher
33 {
34 class Base;
35 class Url;
36
37 using CoverFetcherPtr = std::shared_ptr<Cover::Fetcher::Base>;
38 using CoverFetcherList = QList<CoverFetcherPtr>;
39
48 class Manager :
49 public QObject
50 {
51 Q_OBJECT
52 SINGLETON(Manager)
53 PIMPL(Manager)
54
55 public:
61 void registerCoverFetcher(CoverFetcherPtr fetcher);
62
68 QList<Url> artistAddresses(const QString& artist) const;
69
76 QList<Url> albumAddresses(const QString& artist, const QString& album) const;
77
83 QList<Url> searchAddresses(const QString& str) const;
84
85 QList<Url> radioSearchAddresses(const QString& stationName, const QString& radioUrl) const;
86
92 QList<Url> searchAddresses(const QString& str,
93 const QString& coverFetcherIdentifier) const;
94
101 CoverFetcherPtr coverfetcher(const Url& url) const;
102
108
109 bool isActive(const CoverFetcherPtr fetcher) const;
110 bool isActive(const QString& identifier) const;
111
120 Url directFetcherUrl(const QString& url) const;
121
122 Url websiteFetcherUrl(const QString& url) const;
123
124 static bool isSearchstringWebsite(const QString& searchstring);
125
126 private slots:
127 void serversChanged();
128 };
129
130 }
131}
132#endif // COVERFETCHMANAGER_H
Retrieve Download Urls for Cover Searcher. CoverFetcherInterface can be registered,...
Definition: CoverFetchManager.h:50
CoverFetcherPtr coverfetcher(const Url &url) const
get a CoverFetcherInterface by a specific url
QList< Url > artistAddresses(const QString &artist) const
get urls for a artist search query
QList< Url > searchAddresses(const QString &str, const QString &coverFetcherIdentifier) const
get urls for a fuzzy query
Url directFetcherUrl(const QString &url) const
If the LibraryItem has a reference to a cover download url an appropriate Url object can be retrieved...
QList< Url > albumAddresses(const QString &artist, const QString &album) const
get urls for a album search query
QList< Url > searchAddresses(const QString &str) const
get urls for a fuzzy query
CoverFetcherList coverfetchers() const
fetches all available cover fetcher
void registerCoverFetcher(CoverFetcherPtr fetcher)
Register a cover fetcher. Per default there is one for Discogs, last.fm and Google.
An Url is defined by its identifier and a custom url string. The identifier is the same as being used...
Definition: CoverFetcherUrl.h:17
Definition: EngineUtils.h:33