mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-30 19:15:08 +01:00
Rename MusicDNS -> Acoustid.
(cherry picked from commit cdb381a85f48f66975162f83dc2c1f2cfe2dd8bf)
This commit is contained in:
parent
2e98ce65d5
commit
7eb4ab8453
@ -180,9 +180,9 @@ set(SOURCES
|
||||
library/librarywatcher.cpp
|
||||
library/sqlrow.cpp
|
||||
|
||||
musicbrainz/acoustidclient.cpp
|
||||
musicbrainz/chromaprinter.cpp
|
||||
musicbrainz/musicbrainzclient.cpp
|
||||
musicbrainz/musicdnsclient.cpp
|
||||
musicbrainz/tagfetcher.cpp
|
||||
|
||||
playlist/dynamicplaylistcontrols.cpp
|
||||
@ -417,8 +417,8 @@ set(HEADERS
|
||||
library/libraryviewcontainer.h
|
||||
library/librarywatcher.h
|
||||
|
||||
musicbrainz/acoustidclient.h
|
||||
musicbrainz/musicbrainzclient.h
|
||||
musicbrainz/musicdnsclient.h
|
||||
musicbrainz/tagfetcher.h
|
||||
|
||||
playlist/dynamicplaylistcontrols.h
|
||||
|
@ -15,7 +15,7 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "musicdnsclient.h"
|
||||
#include "acoustidclient.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QNetworkReply>
|
||||
@ -26,22 +26,22 @@
|
||||
#include "core/network.h"
|
||||
#include "core/timeconstants.h"
|
||||
|
||||
const char* MusicDnsClient::kClientId = "qsZGpeLx";
|
||||
const char* MusicDnsClient::kUrl = "http://api.acoustid.org/v2/lookup";
|
||||
const int MusicDnsClient::kDefaultTimeout = 5000; // msec
|
||||
const char* AcoustidClient::kClientId = "qsZGpeLx";
|
||||
const char* AcoustidClient::kUrl = "http://api.acoustid.org/v2/lookup";
|
||||
const int AcoustidClient::kDefaultTimeout = 5000; // msec
|
||||
|
||||
MusicDnsClient::MusicDnsClient(QObject* parent)
|
||||
AcoustidClient::AcoustidClient(QObject* parent)
|
||||
: QObject(parent),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
timeouts_(new NetworkTimeouts(kDefaultTimeout, this))
|
||||
{
|
||||
}
|
||||
|
||||
void MusicDnsClient::SetTimeout(int msec) {
|
||||
void AcoustidClient::SetTimeout(int msec) {
|
||||
timeouts_->SetTimeout(msec);
|
||||
}
|
||||
|
||||
void MusicDnsClient::Start(int id, const QString& fingerprint, int duration_msec) {
|
||||
void AcoustidClient::Start(int id, const QString& fingerprint, int duration_msec) {
|
||||
typedef QPair<QString, QString> Param;
|
||||
|
||||
QList<Param> parameters;
|
||||
@ -62,18 +62,18 @@ void MusicDnsClient::Start(int id, const QString& fingerprint, int duration_msec
|
||||
timeouts_->AddReply(reply);
|
||||
}
|
||||
|
||||
void MusicDnsClient::Cancel(int id) {
|
||||
void AcoustidClient::Cancel(int id) {
|
||||
QNetworkReply* reply = requests_.key(id);
|
||||
requests_.remove(reply);
|
||||
delete reply;
|
||||
}
|
||||
|
||||
void MusicDnsClient::CancelAll() {
|
||||
void AcoustidClient::CancelAll() {
|
||||
qDeleteAll(requests_.keys());
|
||||
requests_.clear();
|
||||
}
|
||||
|
||||
void MusicDnsClient::RequestFinished() {
|
||||
void AcoustidClient::RequestFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
if (!reply)
|
||||
return;
|
@ -15,8 +15,8 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MUSICDNSCLIENT_H
|
||||
#define MUSICDNSCLIENT_H
|
||||
#ifndef ACOUSTIDCLIENT_H
|
||||
#define ACOUSTIDCLIENT_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
@ -26,19 +26,19 @@ class NetworkTimeouts;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
|
||||
class MusicDnsClient : public QObject {
|
||||
class AcoustidClient : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
// Gets a MBID from a Chromaprint fingerprint.
|
||||
// A fingerprint identifies one particular encoding of a song and is created
|
||||
// by Fingerprinter. An MBID identifies the actual song and can be passed to
|
||||
// Musicbrainz to get metadata.
|
||||
// You can create one MusicDnsClient and make multiple requests using it.
|
||||
// You can create one AcoustidClient and make multiple requests using it.
|
||||
// IDs are provided by the caller when a request is started and included in
|
||||
// the Finished signal - they have no meaning to MusicDnsClient.
|
||||
// the Finished signal - they have no meaning to AcoustidClient.
|
||||
|
||||
public:
|
||||
MusicDnsClient(QObject* parent = 0);
|
||||
AcoustidClient(QObject* parent = 0);
|
||||
|
||||
// Network requests will be aborted after this interval.
|
||||
void SetTimeout(int msec);
|
||||
@ -71,4 +71,4 @@ private:
|
||||
QMap<QNetworkReply*, int> requests_;
|
||||
};
|
||||
|
||||
#endif // MUSICDNSCLIENT_H
|
||||
#endif // ACOUSTIDCLIENT_H
|
@ -17,9 +17,9 @@
|
||||
|
||||
#include "tagfetcher.h"
|
||||
|
||||
#include "acoustidclient.h"
|
||||
#include "chromaprinter.h"
|
||||
#include "musicbrainzclient.h"
|
||||
#include "musicdnsclient.h"
|
||||
#include "core/timeconstants.h"
|
||||
|
||||
#include <QFuture>
|
||||
@ -30,10 +30,10 @@
|
||||
TagFetcher::TagFetcher(QObject* parent)
|
||||
: QObject(parent),
|
||||
fingerprint_watcher_(NULL),
|
||||
musicdns_client_(new MusicDnsClient(this)),
|
||||
acoustid_client_(new AcoustidClient(this)),
|
||||
musicbrainz_client_(new MusicBrainzClient(this))
|
||||
{
|
||||
connect(musicdns_client_, SIGNAL(Finished(int,QString)), SLOT(PuidFound(int,QString)));
|
||||
connect(acoustid_client_, SIGNAL(Finished(int,QString)), SLOT(PuidFound(int,QString)));
|
||||
connect(musicbrainz_client_, SIGNAL(Finished(int,MusicBrainzClient::ResultList)), SLOT(TagsFetched(int,MusicBrainzClient::ResultList)));
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ void TagFetcher::Cancel() {
|
||||
fingerprint_watcher_ = NULL;
|
||||
}
|
||||
|
||||
musicdns_client_->CancelAll();
|
||||
acoustid_client_->CancelAll();
|
||||
musicbrainz_client_->CancelAll();
|
||||
songs_.clear();
|
||||
}
|
||||
@ -84,7 +84,7 @@ void TagFetcher::FingerprintFound(int index) {
|
||||
}
|
||||
|
||||
emit Progress(song, tr("Identifying song"));
|
||||
musicdns_client_->Start(index, fingerprint, song.length_nanosec() / kNsecPerMsec);
|
||||
acoustid_client_->Start(index, fingerprint, song.length_nanosec() / kNsecPerMsec);
|
||||
}
|
||||
|
||||
void TagFetcher::PuidFound(int index, const QString& puid) {
|
||||
|
@ -24,12 +24,12 @@
|
||||
#include <QFutureWatcher>
|
||||
#include <QObject>
|
||||
|
||||
class MusicDnsClient;
|
||||
class AcoustidClient;
|
||||
|
||||
class TagFetcher : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
// High level interface to Fingerprinter, MusicDnsClient and
|
||||
// High level interface to Fingerprinter, AcoustidClient and
|
||||
// MusicBrainzClient.
|
||||
|
||||
public:
|
||||
@ -54,7 +54,7 @@ private:
|
||||
static QString GetFingerprint(const Song& song);
|
||||
|
||||
QFutureWatcher<QString>* fingerprint_watcher_;
|
||||
MusicDnsClient* musicdns_client_;
|
||||
AcoustidClient* acoustid_client_;
|
||||
MusicBrainzClient* musicbrainz_client_;
|
||||
|
||||
SongList songs_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user