2018-08-09 18:39:44 +02:00

69 lines
1.8 KiB
C++

/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
*
* 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:
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