Feature/incomplete albums - #13
Merged
Merged
Conversation
If the user has some songs from a specific album, but not all of them, the real solution is immediately discarded. This commit is the first of a series that will implement support for these incomplete albums. The point of this patch is to make sure missing commits are taken into account when calculating the distance between an album and its canonical data. Note that in order not to break API compatibility, the album_distance call for the plugins receives a purged version of both the items and the album info, resulting in some potential accuracy if the plugin bases itself on the index of a track in album_info.tracks.
In the function order_items, instead of automatically reject the canonical candidate if it has more tracks, the function still tries to find matches for the tracks amongst the items, and otherwise uses None to fill the void in order to keep the information about the track numbers
This commit disables the autoreject for incomplete albums. There is several one-liner fixes in autotag/__init__.py and importer.py, as well as some UI additions to report to the user when a track seems missing.
Member
|
This is fantastic; thanks. I didn't even realize that the Munkres implementation would accept partial matches (i.e., non-square matrices), but this seems to work fine. I also like the design decision to use a MISSING_WEIGHT value for the gaps. I see the issue with the plugin interface. I actually think the right thing to do may be to change the interface and to update all the plugins that do distance calculation (I think it's just the fingerprinting plugins, so that should actually be easy). I'll look into this. (Also, because the project's bugs are still sadly on Google Code, I've opened an issue there as well so I don't forget to merge this this.) |
Contributor
Author
|
Ok, further comments on this at Google Code then :-) |
sampsyo
added a commit
that referenced
this pull request
Dec 1, 2011
Tag incomplete albums (#260 on Google Code)
snejus
added a commit
that referenced
this pull request
May 17, 2026
Fixes #6601 Added `import contextvars` and changed `_extend_pipeline` to capture the current context and run the inner pipeline within it to ensure the `music_dir` context variable is available when the inner pipeline resolves paths, preventing the relative-path bug that caused could not get filesize errors and removing 0 old duplicated items during merge. Works perfectly after the fix: ```bash arsaboo@arsmusic:~$ beet import -m -I -t ~/shared/music/ --set genre="Filmi" --search-id 7MwKD3kEFMov4LQqyhnmzL /home/arsaboo/shared/music (1 items) Match (75.2%): King - Lukkhe ≠ artist, tracks Spotify, None, 2026, None, Warner Music India, None, None https://open.spotify.com/album/7MwKD3kEFMov4LQqyhnmzL ≠ Artist: King; OAFF; Savera; Sunny M.R. -> King * Album: Lukkhe ≠ (#2) Khamoshiyaan (3:03) -> (#2) Khamoshiyaan (feat. Romy & Manreet Khara) (3:03) Missing tracks (13/14 - 92.9%): ! Bulletproof (#1) (3:09) ! Jee Lenge (#3) (3:25) ! Headshot (#4) (3:10) ! Ruh Teri (feat. Manreet Khara & Agrim Joshi) (#5) (2:31) ! Roobaroo (#6) (3:17) ! Savere (#7) (2:29) ! Haal (#8) (3:29) ! Haal (The Journey) (#9) (6:13) ! Nachdi Shaam (#10) (2:22) ! Hoga Bada Mera Naam (#11) (1:58) ! All Eyes On Us (#12) (3:13) ! Swan Song (Hoya Azaad) (#13) (3:17) ! Bhaari Pangey (#14) (2:19) ➜ [A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums, Enter search, enter Id, aBort, eDit, edit Candidates, Print tracks, Open files with Picard? a This album is already in the library! Old: 3 items, MP3, 320kbps, 9:45, 22.9 MiB New: 1 items, MP3, 320kbps, 3:03, 7.8 MiB ➜ [S]kip new, Keep all, Remove old, Merge all? m /home/arsaboo/shared/music /data/music/Hindi Music/L/Lukkhe [30718] (2026)/Lukkhe (2026) - Bulletproof.mp3 /data/music/Hindi Music/L/Lukkhe [30718] (2026)/Lukkhe (2026) - Headshot.mp3 /data/music/Hindi Music/L/Lukkhe [30718] (2026)/Lukkhe (2026) - Jee Lenge.mp3 (4 items) Match (82.6%): King - Lukkhe ≠ artist, tracks Spotify, None, 2026, None, Warner Music India, None, None https://open.spotify.com/album/7MwKD3kEFMov4LQqyhnmzL ≠ Artist: OAFF; Savera; Ruaa Kayy; Romy; Manreet Khara -> King * Album: Lukkhe * (#1) Bulletproof (3:09) ≠ (#2) Khamoshiyaan (3:03) -> (#2) Khamoshiyaan (feat. Romy & Manreet Khara) (3:03) * (#3) Jee Lenge (3:25) * (#4) Headshot (3:10) Missing tracks (10/14 - 71.4%): ! Ruh Teri (feat. Manreet Khara & Agrim Joshi) (#5) (2:31) ! Roobaroo (#6) (3:17) ! Savere (#7) (2:29) ! Haal (#8) (3:29) ! Haal (The Journey) (#9) (6:13) ! Nachdi Shaam (#10) (2:22) ! Hoga Bada Mera Naam (#11) (1:58) ! All Eyes On Us (#12) (3:13) ! Swan Song (Hoya Azaad) (#13) (3:17) ! Bhaari Pangey (#14) (2:19) ➜ [A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums, Enter search, enter Id, aBort, eDit, edit Candidates, Print tracks, Open files with Picard? a ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With this series of patches, beets take into account the fact that sometimes, we do not have the whole album but only some songs — the reasons can vary, in my case I generally remove the tracks that contain only dialogs.
The first two patches modify the distance and ordering of autotagging, and come with the appropriate tests. The last one simply enables this feature in the import.
The only problem there is is for the plugin interface, specifically the album_distance call.
I could either provide the whole data which would probably break explicitly every plugin that implement that call when dealing with the missing tracks (None dereferencing), or purge the data from the faulty entries, thus changing the indexing of the tracks in the canonical informations. I chose the latter, given that it would probably affect way less plugins, but the breakage sadly occurs silently in that case.