Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Musicbrainz: Improved messages in case of empty results #13672

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/library/dlgtagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,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
Loading