Open Sean-T-Moore opened 1 year ago
As you intuited, the likely explanation here is that the correct match is too far down the list in the set of responses that MusicBrainz returns. Even with filters like preferred countries, we need to do that on the client side—that is, we need to fetch the top N albums and then sort them by these criteria; we can't do that before truncating the list to N.
You can adjust the number of results we request from MusicBrainz from the default 5: https://beets.readthedocs.io/en/stable/reference/config.html#searchlimit
Doing this makes searches take longer but is more likely to find the specific release you want, for release groups with large numbers of variants.
Adrian,
Thanks for pointing out the 'searchlimit' config parameter. By setting that higher, beets was in fact able to find and properly suggest the correct album release. The downside as you point out, is much longer search times before importer prompts user for action.
On my computer it takes about 1.5 seconds for each candidate, which adds up when I set searchlimit high. Until playing with beets and MusicBrainz, I had no idea my albums had so many variants!
I started investigating why this search takes so long. My first thought was that calls to MusicBrainz API must be the problem or rate limited. I tested out some calls to musicbrainzngs.search_releases(artist=artist, release=album, limit=<n>)
and I find that it takes essentially the same time to return 25 releases as it does to return 5 (less than a second). So I don't think the API is the problem. The delay seems to be that beets incrementally evaluates every release, even after it finds a perfect match. Is there a reason why beets needs to keep evaluating after it finds a match?
As a user, I do not know a priori how many candidates I need to tell beets to evaluate before a good match is found. Wouldn't it make more sense for beets to just download all candidates, loop through them evaluating the 'distance', and then stop when a 100% match is found? This would be fast when the match is early in the list and would guarantee that a match is eventually found. Only if the user is not satisfied with the first '100% match' would beets need to be instructed to continue to evaluate more of the candidates. @sampsyo your thoughts?
In general, there are two things that take time when beets is matching albums:
The first thing is probably dominant in most cases, but you might try profiling in even more detail if you're curious! The computational side is theoretically avoidable if we wanted to eagerly discard matches, but it could be sort of complicated to rearrange things to make that work.
By changing my workflow, the extra delay with setting a high searchlimit becomes a non-issue. Instead of rip-import-rip-import, I rip a stack of CDs and then import all at once. By the time I've finished answering the first set of import questions, the second import has been evaluated and is ready for review. No user-noticeable delay after the first import, presumably due to the magic of the parallel import pipeline. Nice!
However, it can still be impossible to determine the correct release version from the beets UI, even with all variants loaded. Musicbrainz considers an album to be a different version if it differs in: media-type, country, year, label or barcode. During the import process, beets does not show the barcode so I can run into the situation where it is impossible to disambiguate. See this example with the Album "The Trinity Session", by "Cowboy Junkies":
I was hoping we could add barcode to the formatted output during candidate selection, but doesn't look like it is included in the AlbumInfo class. I suppose it could be added since it is returned by the MB API.
For the task of importing full albums that are in the musicbrainz DB, it would seem to me that a single call to musicbrainzngs.search_releases(artist=artist, release=album)
is all that is needed to return all the details that are needed to display and have the user correctly choose the proper match for an album in hand, assuming album title and artist are read from the input music file tags.
I'm wondering if a simpler import for this kind of use case (album in hand) would be possible as a plugin that then passes the correct MusicBrainz ID back to the normal importer to finish the task? Or maybe we just need to store and display barcode in the normal importer.
A possible solution would be an option when selecting the release to load more search results. This way you don't have to increase the search limit and make everything slower but can load more releases when needed.
Both of these (including more info in the disambiguation string and a "load more" option) seem reasonable. The first is actually already covered by #845. It probably wouldn't be too hard to implement, if you're interested.
I've coded the changes needed to get barcode from MusicBrainz and to display it with the other disambiguation info during import. Seems to work well for my use case. I will test a little more and then submit a PR shortly.
Greetings,
I recently discovered beets and have been trying to import my CD collection. I'm having trouble getting the importer to present the correct album version as a candidate for selection. First I rip the CD with 'fre:ac' and I find it adds correct tags to my FLAC file for: ARTIST, TITLE, ALBUM, DATE, GENRE, MEDIA. When I start the import, beets is able to correctly deduce the Album and Artist and will present what it thinks is a match, but this is often the wrong country or wrong year for the album release. So in my config I added a match preference to try and force only candidates associated with my country, media type, and album year.
This doesn't help much. I continue to get candidates for other media types and countries. Beets knows these aren't great matches and assigns them less than a 100% score. Here is a screenshot of trying to import the Album:
The candidate presented isn't a perfect match since the year doesn't match. So I ask for more candidates and get five that aren't matches:
What is frustrating is that if I bring up the MusicBrainz release versions page, I can see the correct version I want is the first one on the page after throwing out entries not matching my country or media type:
To get around this problem, I find the correct release on MusicBrainz and paste it into the beets importer prompt. When I do that, now beets shows my manual entry as a 100% match!
What is going on here? Is beets not getting all the possible candidates back from MusicBrainz in order to try and find a better match? Is there a way to ask for more candidates other than the five I see during the import session? Having to manually search the website for the correct match and pasting it into beets becomes tedious fast.
Debug
Running 'beet import' in verbose (
-vv
) mode:Setup
My configuration (output of
beet config
) is: