Use fingerprints from database if available when fetching tags from MusicBrainz
This commit is contained in:
@@ -55,14 +55,31 @@ void TagFetcher::StartFetch(const SongList &songs) {
|
|||||||
|
|
||||||
songs_ = songs;
|
songs_ = songs;
|
||||||
|
|
||||||
|
bool have_fingerprints = true;
|
||||||
|
|
||||||
|
for (const Song &song : songs_) {
|
||||||
|
if (song.fingerprint().isEmpty()) {
|
||||||
|
have_fingerprints = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (have_fingerprints) {
|
||||||
|
for (int i = 0 ; i < songs_.count() ; ++i) {
|
||||||
|
const Song &song = songs_[i];
|
||||||
|
emit Progress(song, tr("Identifying song"));
|
||||||
|
acoustid_client_->Start(i, song.fingerprint(), static_cast<int>(song.length_nanosec() / kNsecPerMsec));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
QFuture<QString> future = QtConcurrent::mapped(songs_, GetFingerprint);
|
QFuture<QString> future = QtConcurrent::mapped(songs_, GetFingerprint);
|
||||||
fingerprint_watcher_ = new QFutureWatcher<QString>(this);
|
fingerprint_watcher_ = new QFutureWatcher<QString>(this);
|
||||||
fingerprint_watcher_->setFuture(future);
|
fingerprint_watcher_->setFuture(future);
|
||||||
QObject::connect(fingerprint_watcher_, &QFutureWatcher<QString>::resultReadyAt, this, &TagFetcher::FingerprintFound);
|
QObject::connect(fingerprint_watcher_, &QFutureWatcher<QString>::resultReadyAt, this, &TagFetcher::FingerprintFound);
|
||||||
|
for (const Song &song : songs_) {
|
||||||
for (const Song &song : songs) {
|
|
||||||
emit Progress(song, tr("Fingerprinting song"));
|
emit Progress(song, tr("Fingerprinting song"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user