strawberry-audio-player-win.../src/musicbrainz/tagfetcher.h

70 lines
2.0 KiB
C++

/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2019-2021, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TAGFETCHER_H
#define TAGFETCHER_H
#include "config.h"
#include <QObject>
#include <QFutureWatcher>
#include <QString>
#include <QStringList>
#include "core/song.h"
#include "musicbrainzclient.h"
class AcoustidClient;
class TagFetcher : public QObject {
Q_OBJECT
// High level interface to Fingerprinter, AcoustidClient and MusicBrainzClient.
public:
explicit TagFetcher(QObject *parent = nullptr);
void StartFetch(const SongList &songs);
public slots:
void Cancel();
signals:
void Progress(Song original_song, QString stage);
void ResultAvailable(Song original_song, SongList songs_guessed, QString error = QString());
private slots:
void FingerprintFound(const int index);
void PuidsFound(const int index, const QStringList &puid_list, const QString &error = QString());
void TagsFetched(const int index, const MusicBrainzClient::ResultList &results, const QString &error = QString());
private:
static QString GetFingerprint(const Song &song);
QFutureWatcher<QString> *fingerprint_watcher_;
AcoustidClient *acoustid_client_;
MusicBrainzClient *musicbrainz_client_;
SongList songs_;
};
#endif // TAGFETCHER_H