Handle multi-disc albums with pre-NGS album IDs by looking up *all* IDs and using them in the match
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Hello,
I have a music library that I tagged using Picard 8 to 10 years ago.
I'm now trying to import it in beets.
### Problem
I think i'm hitting a quite specific corner case when importing a release consisting in two discs, 15 tracks each.
```sh
$ ls -R a
a:
Armstrong, Louis - The Very Best of Louis Armstrong (disc 1)
Armstrong, Louis - The Very Best of Louis Armstrong (disc 2)
a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 1):
01 What a Wonderful World.mp3
...
15 When the Saints Go Marching In.mp3
folder.jpg
a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 2):
01 Mack the Knife.mp3
...
15 Love Is Here to Stay.mp3
folder.jpg
```
All the tracks were tagged using Picard years ago, and at the time the official MusicBrainz style guideline was to create one separate release for each disc of a multi-disc boxset. This was the pre-[NGS](https://wiki.musicbrainz.org/History:Next_Generation_Schema) era (
here is the [2011 release note](https://wiki.musicbrainz.org/History:Server_Release_Notes/20110516) describing the change regarding multi-disc releases).
As a consequence, tracks from each disc have different Album Ids:
```sh
$ mutagen-inspect a/Armstrong\,\ Louis\ -\ The\ Very\ Best\ of\ Louis\ Armstrong\ \(disc\ 1\)/01\ What\ a\ Wonderful\ World.mp3 |grep -i alb
TALB=The Very Best of Louis Armstrong (disc 1)
TXXX=ALBUMARTISTSORT=Armstrong, Louis
TXXX=MusicBrainz Album Artist Id=eea8a864-fcda-4602-9569-38ab446decd6
TXXX=MusicBrainz Album Id=eabaa9bd-9d49-4b84-aff4-c1f626f2f534
TXXX=MusicBrainz Album Release Country=GB
TXXX=MusicBrainz Album Status=official
TXXX=MusicBrainz Album Type=compilation
$ mutagen-inspect a/Armstrong\,\ Louis\ -\ The\ Very\ Best\ of\ Louis\ Armstrong\ \(disc\ 2\)/01\ Mack\ the\ Knife.mp3 |grep -i alb
TALB=The Very Best of Louis Armstrong (disc 2)
TXXX=ALBUMARTISTSORT=Armstrong, Louis
TXXX=MusicBrainz Album Artist Id=eea8a864-fcda-4602-9569-38ab446decd6
TXXX=MusicBrainz Album Id=fcb6a8d5-e134-4124-bfb8-55061887a9a2
TXXX=MusicBrainz Album Release Country=GB
TXXX=MusicBrainz Album Status=official
TXXX=MusicBrainz Album Type=compilation
```
So disc 1 is https://musicbrainz.org/release/eabaa9bd-9d49-4b84-aff4-c1f626f2f534
and disc 2 is https://musicbrainz.org/release/fcb6a8d5-e134-4124-bfb8-55061887a9a2
which both lead to the same page, I think the musicbrainz people have merged the disc 2 release into the disc one release.
Beets seems confused when importing the release
```sh
$ beet import -W a
/home/seb/a
/home/seb/a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 1)
/home/seb/a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 2) (30 items)
Finding tags for album "Louis Armstrong - The Very Best of Louis Armstrong (disc 2)".
Candidates:
1. Louis Armstrong - The Very Best of Louis Armstrong (33.2%) (tracks, missing tracks, id, ...) (2xCD, 2000, GB, Universal Music TV)
2. Louis Armstrong - The Very Best of Louis Armstrong (32.3%) (tracks, id, unmatched tracks, ...)
3. Louis Armstrong - The Very Best of Louis Armstrong (31.9%) (tracks, unmatched tracks, id, ...)
4. Louis Armstrong - The Very Best of Louis Armstrong (31.8%) (tracks, unmatched tracks, id, ...) (CD, 2000, CA, Universal Music Canada)
5. Louis Armstrong - The Very Best of Louis Armstrong (31.6%) (tracks, missing tracks, id, ...) (2xCD, 1998, Universal Music France)
# selection (default 1), Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort?
```
beet merged the two folders as expected, but does not find the one good release and is not very informative when prompting for help
* I don't know how much tracks it is trying to match for the "disc 2" release (15, 30?)
* I don't know how many tracks are in the proposals it makes, and since it does not show links to the musicbrainz releases, I can't look myself in a web browser
If I select the default choice (1), I get
```
Correcting tags from:
Louis Armstrong - The Very Best of Louis Armstrong (disc 2)
To:
Louis Armstrong - The Very Best of Louis Armstrong
URL:
https://musicbrainz.org/release/a916a1c9-1bd1-4298-9288-7b551fed6b99
(Similarity: 33.2%) (tracks, missing tracks, id, label, year, album) (2xCD, 2000, GB, Universal Music TV)
CD 1
* Hello Dolly (#8) -> Hello Dolly! (#1) (id, index)
* What a Wonderful World (#1) -> What a Wonderful World (#2) (id, index)
* Your Cheatin' Heart -> Jeepers Creepers (id, title)
* Nobody Knows the Trouble I've Seen (4:54) -> King of the Zulus (4:40) (id, title, length)
* April in Paris (feat. Ella Fitzgerald) (6:36) -> We Have All the Time in the World (3:12) (id, title, length)
* Let's Call the Whole Thing Off (feat. Ella Fitzgerald) (#3) -> Let's Call the Whole Thing Off (#6) (id, index, title)
* La Cucaracha (#8) -> Alexander's Ragtime Band (#7) (id, title, index)
* Kiss of Fire -> You Can't Lose a Broken Heart (id, title)
* Let's Fall in Love -> East of the Sun (And West of the Moon) (id, title)
* Stormy Weather (#12) -> Stormy Weather (#11) (id, index)
* C'est si bon (#7) (3:05) -> C'est Si Bon (#12) (2:21) (id, length, index)
* La Vie En Rose (#6) -> La Vie En Rose (#14) (id, index)
* Love Is Here to Stay -> We'll Be Together Again (id, title)
* Summertime (feat. Ella Fitzgerald) (#13) -> Summertime (#17) (id, index, title)
* I Was Doing All Right (feat. Oscar Peterson) (#13) (3:24) -> I'm in the Mood for Love (#20) (3:09) (id, title, index, length)
CD 2
* When the Saints Go Marching In (#15) (3:12) -> When the Saints Go Marchin' In (#21) (2:42) (id, length, index, title)
* Mack the Knife (#1) (3:23) -> Mack the Knife (#22) (3:34) (id, index, length)
* Stars Fell on Alabama (feat. Ella Fitzgerald) (#11) -> Stars Fell on Alabama (#25) (id, index, title)
* Swing Low, Sweet Chariot (#6) -> Georgia Bo Bo (#26) (id, title)
* Falling in Love With You (#7) -> She's the Daughter of a Planter From Havana (#27) (id, title)
* Because of You (#2) -> You Rascal You (#28) (id, title, index)
* Cheek to Cheek (feat. Ella Fitzgerald) (#2) (5:55) -> Baby, It's Cold Outside (#30) (5:41) (id, title, index, length)
* Can't We Be Friends (feat. Ella Fitzgerald) (#12) (3:49) -> When You're Smiling (The Whole World Smiles With You) (#32) (4:02) (id, title, length)
* I Love Jazz (#14) -> Pretty Little Missy (#33) (id, title, index)
* Uncle Satchmo's Lullaby (feat. Gabriele) (#5) -> Oh Bess, Oh Where's My Bess (#35) (id, title, index)
* Blueberry Hill (#9) -> Blueberry Hill (#36) (id, index)
* Dream a Little Dream (#11) -> Dream a Little Dream (#37) (id, index)
* That Old Feeling (feat. Oscar Peterson) (#10) (2:45) -> Gone Fishin' (#38) (2:31) (id, title, index, length)
* Body and Soul (#14) -> They Can't Take That Away From Me (#39) (id, title, index)
* What's New (#4) (2:43) -> Ain't Misbehavin' (#40) (2:53) (id, title, index, length)
Missing tracks (10/40 - 25.0%):
! I Gotta Right to Sing the Blues (#8) (3:55)
! Let's Do It (Let's Fall in Love) (#13) (8:47)
! Makin' Whoopee (#16) (3:56)
! Top Hat, White Tie, and Tails (#18) (4:10)
! Basin Street Blues (#19) (5:13)
! Gee, Baby, Ain't I Good to You (#23) (4:11)
! Don't Fence Me In (#24) (5:21)
! Just One of Those Things (#29) (4:02)
! Tenderly (#31) (5:06)
! Lazy River (#34) (3:49)
```
which is a third release (ie. neither the one from disc 1 tags nor disc 2 tags), and seems quite wrong: it has 10 extraneous tracks out of 30.
Note that beets does not seem deterministic, running the exact same command, I also got the good answer from time to time:
```
$ beet import -W a
/home/seb/a
/home/seb/a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 1)
/home/seb/a/Armstrong, Louis - The Very Best of Louis Armstrong (disc 2) (30 items)
Correcting tags from:
Louis Armstrong - The Very Best of Louis Armstrong (disc 2)
To:
Louis Armstrong - The Very Best of Louis Armstrong
URL:
https://musicbrainz.org/release/eabaa9bd-9d49-4b84-aff4-c1f626f2f534
(Similarity: 73.9%) (tracks, id, album) (2xCD, 2003, GB, Universal Records)
CD 1
* What a Wonderful World -> What a Wonderful World (id)
* Cheek to Cheek (feat. Ella Fitzgerald) -> Cheek to Cheek (id, title)
* Let's Call the Whole Thing Off (feat. Ella Fitzgerald) -> Let’s Call the Whole Thing Off (title)
* Nobody Knows the Trouble I've Seen -> Nobody Knows the Trouble I’ve Seen (id)
* Uncle Satchmo's Lullaby (feat. Gabriele) -> Uncle Satchmo’s Lullaby (title)
* La Vie En Rose -> La Vie en rose
* C'est si bon -> C’est si bon
* Hello Dolly -> Hello, Dolly! (id)
* Let's Fall in Love -> Let’s Fall in Love
* Can't We Be Friends (feat. Ella Fitzgerald) -> Can’t We Be Friends (title)
* Summertime (feat. Ella Fitzgerald) -> Summertime (id, title)
* When the Saints Go Marching In -> When the Saints Go Marching In (id)
CD 2
* Mack the Knife (#1) -> Mack the Knife (#16) (id)
* Because of You (#2) -> Because of You (#17) (id)
* Your Cheatin' Heart (#3) -> Your Cheatin’ Heart (#18)
* What's New (#4) -> What’s New? (#19) (id)
* April in Paris (feat. Ella Fitzgerald) (#5) -> April in Paris (#20) (id, title)
* Swing Low, Sweet Chariot (#6) -> Swing Low, Sweet Chariot (#21)
* Falling in Love With You (#7) -> Falling in Love With You (#22) (id)
* La Cucaracha (#8) -> La Cucaracha (#23) (id)
* Blueberry Hill (#9) -> Blueberry Hill (#24) (id)
* That Old Feeling (feat. Oscar Peterson) (#10) -> That Old Feeling (#25) (title)
* Stars Fell on Alabama (feat. Ella Fitzgerald) (#11) -> Stars Fell on Alabama (#26) (id, title)
* Stormy Weather (#12) -> Stormy Weather (#27) (id)
* I Was Doing All Right (feat. Oscar Peterson) (#13) -> I Was Doing All Right (#28) (title)
* Body and Soul (#14) -> Body and Soul (#29)
* Love Is Here to Stay (#15) -> Love Is Here to Stay (#30)
Apply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? b
```
(beets seemed to give the good answer more often when running with the ``-vv`` flag, as if it knew I was filing a defect report).
Importing this release in picard, then saving the files with the updated tags, then importing back in beets worked perfectly.
Picard probably has some specific logic for dealing with merged releases.
### Setup
* OS: debian stretch
* beets version 1.4.7
* Python version 2.7.13
My configuration (output of `beet config`) is:
```yaml
$ beet config
directory: ~/beet/music
import:
write: no
asciify_paths: yes
library: ~/beet/library.db
plugins: web
web:
cors_supports_credentials: no
reverse_proxy: no
host: 127.0.0.1
include_paths: no
cors: ''
port: 8337
```
Contributor guide
Research direction
Start with the beet import path and its MusicBrainz release-matching logic. Reproduce the supplied 30-track, two-disc import using the legacy Album IDs and compare candidate selection with and without -vv. Done means both IDs are considered together, the merged release is selected consistently, and the prompt makes track counts and release links clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100