Clementine-audio-player-Mac.../src/musicbrainz/tagfetcher.h

64 lines
1.7 KiB
C++

/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TAGFETCHER_H
#define TAGFETCHER_H
#include <QFutureWatcher>
#include <QObject>
#include "core/song.h"
#include "musicbrainzclient.h"
class AcoustidClient;
class TagFetcher : public QObject {
Q_OBJECT
// High level interface to Fingerprinter, AcoustidClient and
// MusicBrainzClient.
public:
TagFetcher(QObject* parent = nullptr);
void StartFetch(const SongList& songs);
public slots:
void Cancel();
signals:
void Progress(const Song& original_song, const QString& stage);
void ResultAvailable(const Song& original_song,
const SongList& songs_guessed);
private slots:
void FingerprintFound(int index);
void PuidsFound(int index, const QStringList& puid_list);
void TagsFetched(int index, const MusicBrainzClient::ResultList& result);
private:
static QString GetFingerprint(const Song& song);
QFutureWatcher<QString>* fingerprint_watcher_;
AcoustidClient* acoustid_client_;
MusicBrainzClient* musicbrainz_client_;
SongList songs_;
};
#endif // TAGFETCHER_H