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

PICARD-2584: Load recording if AcoustId metadata is missing #2351

Merged
merged 8 commits into from
Jan 7, 2024

Conversation

phw
Copy link
Member

@phw phw commented Dec 21, 2023

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

Problem

AcoustID can sometimes contain no MB metadata for linked recordings. This happens if:

  1. recordings have been merged and this merge was not yet handled by the AcoustID server
  2. recordings have been deleted and the AcoustID server has not yet cleaned up

AFAIK both should be handled by AcoustID, but currently this does not seem to work correctly (e.g. acoustid/acoustid-server#114). There can always be some time frame where this has not been done as there is some delay in AcoustID database synchronizing., though

In case of 1) this can lead to recording data not being available and files getting matched to standalone recordings instead. It also messes with submission counts.

Examples:

In case of 2) this can lead to files being matched to a standalone-recording that does not load.

Examples:

Solution

If AcoustID provides no MB metadata but only MB recording ID load the recording data from the MB web service. This is done by the new RecordingResolver in the picard.acoustid package.

If metadata is provided, the recording is used directly. If not a MB web service call to load the recording is initiated.

If the recording no longer exist (404) then the result is ignored. If it exists and was redirected to another recording MBID that is also linked to the same AcoustID, the submission counts get combined.

@phw phw force-pushed the PICARD-2584-acoustid-missing-metadata branch from ab65038 to f7485ce Compare December 21, 2023 22:21
picard/acoustid/__init__.py Outdated Show resolved Hide resolved
@phw phw force-pushed the PICARD-2584-acoustid-missing-metadata branch from 9ff8e76 to 6e3bea1 Compare December 22, 2023 16:04
picard/acoustid/recordings.py Outdated Show resolved Hide resolved
picard/acoustid/recordings.py Outdated Show resolved Hide resolved
phw added 2 commits December 27, 2023 17:22
This resolves problem with AcoustID scan finding no matches or only
standalone-recordings.
@phw phw force-pushed the PICARD-2584-acoustid-missing-metadata branch from 6e3bea1 to f1aa249 Compare December 27, 2023 16:22
@phw phw force-pushed the PICARD-2584-acoustid-missing-metadata branch from f1aa249 to 0bfcc2a Compare December 27, 2023 16:25
phw added 2 commits January 6, 2024 13:18
This reduces the number of additional calls while still providing enough
data to avoid mismatches.
This avoids duplicate lookup calls for the essentially the same recording.
@phw phw added the Feature label Jan 6, 2024
@phw phw marked this pull request as ready for review January 6, 2024 12:36
@phw
Copy link
Member Author

phw commented Jan 6, 2024

@zas I made a few enhancements, and I think this is now ready for review. With the changes I don't get significantly longer loading times while still eliminating the standalone recording results for my 5k test files.

The changes allowing this are:

  • If a recording without metadata is returned from AcoustID it is ignored unless it has more then 25% submission count compared to the recording with highest submission count.
  • Loaded recording IDs are cached and only loaded if they are not in cache. This avoids loading the same recording twice. This cache includes redirects.
  • A max. of 3 recordings without metadata are resolved for a single AcoustID. That means any AcoustID lookup never can trigger more then 3 additional lookups. The 3 recordings being looked up are always the three with the highest submission count.

Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

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

Very clean patch, good job! LGTM

@phw phw merged commit 6f405eb into metabrainz:master Jan 7, 2024
45 checks passed
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.

2 participants