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

Open
wants to merge 2 commits into
base: 2.4
Choose a base branch
from

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Sep 20, 2024

Allow to use different messages in case Musikbrainz lookup ends without results.
This fixes #13666

Since this PR moves a translatable text form on object to another we need an Transifex cycle to not loose the translation in the stable 2.4 branch.

@daschuer daschuer added this to the 2.4.2 milestone Sep 20, 2024
Copy link
Member

@acolombier acolombier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just a small optional nit

@@ -165,7 +166,8 @@ void TagFetcher::slotAcoustIdTaskSucceeded(

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: casing of AcoustID

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also fixed another occourenc, and will also fix Translations after merge.

Comment on lines 304 to 312
QString whyEmptyMessage;
if (guessedTrackReleases.empty()) {
whyEmptyMessage = tr("Could not find this track in the MusicBrainz database.");
}

emit resultAvailable(
std::move(pTrack),
std::move(guessedTrackReleases));
std::move(guessedTrackReleases),
whyEmptyMessage);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the check is clunky and unnecessary from what I can tell. Can you just inline like you did with the other calls?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so just

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

Copy link
Member

@Swiftb0y Swiftb0y Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if unconditionally looking up the translated string presents too much overhead, we can also introduce an enum and switch on it only in the failure case (in DlgTagFetcher::fetchTagFinished), thereby deferring the tr() call in exchange for a little extra boilerplate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we add the text even if we have a list of tracks. I think it is clearer to have to dedicated emmit calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, one in case of success and a different one in case of error would also be better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather thought of two different signals (with differing parameters), but the current solution works too ig. not widening the scope too much.

@daschuer
Copy link
Member Author

Done

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks you. Waiting for CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants