2011-03-12 22:19:41 +01:00
|
|
|
/* 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 "musicbrainzclient.h"
|
|
|
|
#include "core/song.h"
|
|
|
|
|
|
|
|
#include <QFutureWatcher>
|
|
|
|
#include <QObject>
|
|
|
|
|
2012-01-06 17:51:27 +01:00
|
|
|
class AcoustidClient;
|
2011-03-12 22:19:41 +01:00
|
|
|
|
|
|
|
class TagFetcher : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-01-06 17:51:27 +01:00
|
|
|
// High level interface to Fingerprinter, AcoustidClient and
|
2011-03-12 23:29:03 +01:00
|
|
|
// MusicBrainzClient.
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2014-02-10 16:03:54 +01:00
|
|
|
TagFetcher(QObject* parent = nullptr);
|
2011-03-12 22:19:41 +01:00
|
|
|
|
|
|
|
void StartFetch(const SongList& songs);
|
2011-03-13 13:52:08 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public slots:
|
2011-03-12 22:19:41 +01:00
|
|
|
void Cancel();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void Progress(const Song& original_song, const QString& stage);
|
|
|
|
void ResultAvailable(const Song& original_song,
|
|
|
|
const SongList& songs_guessed);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private slots:
|
2011-03-12 22:19:41 +01:00
|
|
|
void FingerprintFound(int index);
|
2014-08-09 01:48:35 +02:00
|
|
|
void PuidsFound(int index, const QStringList& puid_list);
|
2011-03-12 22:19:41 +01:00
|
|
|
void TagsFetched(int index, const MusicBrainzClient::ResultList& result);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2011-03-12 22:19:41 +01:00
|
|
|
static QString GetFingerprint(const Song& song);
|
|
|
|
|
|
|
|
QFutureWatcher<QString>* fingerprint_watcher_;
|
2012-01-06 17:51:27 +01:00
|
|
|
AcoustidClient* acoustid_client_;
|
2011-03-12 22:19:41 +01:00
|
|
|
MusicBrainzClient* musicbrainz_client_;
|
|
|
|
|
|
|
|
SongList songs_;
|
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // TAGFETCHER_H
|