Skip to content

Commit

Permalink
Merge pull request mixxxdj#13672 from daschuer/gh13666
Browse files Browse the repository at this point in the history
Musicbrainz: Improved messages in case of empty results
  • Loading branch information
ronso0 authored Sep 23, 2024
2 parents feb320a + 4f4f281 commit f5890a8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/library/dlgtagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ void DlgTagFetcher::setPercentOfEachRecordings(int totalRecordingsFound) {

void DlgTagFetcher::fetchTagFinished(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases) {
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage) {
VERIFY_OR_DEBUG_ASSERT(pTrack == m_pTrack) {
return;
}
m_data.m_tags = guessedTrackReleases;
if (guessedTrackReleases.size() == 0) {
loadingProgressBar->setValue(kMaximumValueOfQProgressBar);
QString emptyMessage = tr("Could not find this track in the MusicBrainz database.");
loadingProgressBar->setFormat(emptyMessage);
loadingProgressBar->setFormat(whyEmptyMessage);
return;
} else {
btnApply->setDisabled(true);
Expand Down
3 changes: 2 additions & 1 deletion src/library/dlgtagfetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class DlgTagFetcher : public QDialog, public Ui::DlgTagFetcher {
private slots:
void fetchTagFinished(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases);
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage);
void tagSelected();
void showProgressOfConstantTask(const QString&);
void setPercentOfEachRecordings(int totalRecordingsFound);
Expand Down
22 changes: 16 additions & 6 deletions src/musicbrainz/tagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ void TagFetcher::slotFingerprintReady() {
if (fingerprint.isEmpty()) {
emit resultAvailable(
m_pTrack,
QList<mixxx::musicbrainz::TrackRelease>());
{},
tr("Reading track for fingerprinting failed."));
return;
}

emit fetchProgress(tr("Identifying track through Acoustid"));
emit fetchProgress(tr("Identifying track through AcoustID"));
DEBUG_ASSERT(!m_pAcoustIdTask);
m_pAcoustIdTask = make_parented<mixxx::AcoustIdLookupTask>(
&m_network,
Expand Down Expand Up @@ -165,7 +166,8 @@ void TagFetcher::slotAcoustIdTaskSucceeded(

emit resultAvailable(
std::move(pTrack),
QList<mixxx::musicbrainz::TrackRelease>());
{},
tr("Could not identify track through AcoustID."));
return;
}

Expand Down Expand Up @@ -299,9 +301,17 @@ void TagFetcher::slotMusicBrainzTaskSucceeded(
auto pTrack = m_pTrack;
terminate();

emit resultAvailable(
std::move(pTrack),
std::move(guessedTrackReleases));
if (guessedTrackReleases.empty()) {
emit resultAvailable(
std::move(pTrack),
{},
tr("Could not find this track in the MusicBrainz database."));
} else {
emit resultAvailable(
std::move(pTrack),
std::move(guessedTrackReleases),
{});
}
}

void TagFetcher::startFetchCoverArtLinks(
Expand Down
3 changes: 2 additions & 1 deletion src/musicbrainz/tagfetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class TagFetcher : public QObject {
signals:
void resultAvailable(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases);
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage); // To explain why the result is empty
void fetchProgress(
const QString& message);
void numberOfRecordingsFoundFromAcoustId(int totalNumberOfRecordings);
Expand Down

0 comments on commit f5890a8

Please sign in to comment.