Keep the album edition in the title, tags and folder name - #1027
Open
sjbrownrigg wants to merge 1 commit into
Open
Keep the album edition in the title, tags and folder name#1027sjbrownrigg wants to merge 1 commit into
sjbrownrigg wants to merge 1 commit into
Conversation
Two different editions of the same album could download into the same folder and merge together. A standard and a deluxe release share a title, a year and often a format, so every key available to folder_format rendered identically for both and the second download landed on top of the first. Qobuz returns the edition in a "version" field, which was discarded. Keep it: fold it into the album title unless the title already says it, so "Into the Gap" becomes "Into the Gap (Deluxe Edition)" in the ALBUM tag and in the folder name, and retain it on AlbumMetadata. Expose "tracktotal" and "version" to folder_format as well. Two same-named editions can still collide -- a 25-track and a 39-track release can both be titled "Deluxe Edition" -- and "tracktotal" tells them apart without falling back to the opaque album id. Add "version" to METADATA_TYPES so FLAC gets a standard Vorbis VERSION field. It is deliberately last in the tuple: MP3_KEY and MP4_KEY are built by zipping METADATA_TYPES against their own positional key tuples, so a trailing entry with no counterpart is dropped for those formats, while FLAC_KEY is a comprehension and picks it up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 15cbb8a)
|
I think this is the problem I'm having. |
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.
Two different editions of the same album can download into the same folder and merge together.
A standard and a deluxe release share a title, a year and often a format, so every key available to
folder_formatrenders identically for both, and the second download lands on top of the first. I ended up with one folder holding a 25-track edition loose in the root and a 39-track 3-disc edition in subfolders, which took a while to work out.Keep the edition
Qobuz returns it in a
versionfield, which is currently discarded. This folds it into the album title unless the title already says it, soInto the GapbecomesInto the Gap (Deluxe Edition)— in theALBUMtag and therefore in the folder name — and keeps it onAlbumMetadataas well.FLAC also gets a standard Vorbis
VERSIONfield."version"is deliberately last inMETADATA_TYPES:MP3_KEYandMP4_KEYare built by zipping that tuple against their own positional key tuples, so a trailing entry with no counterpart is dropped for those formats, whileFLAC_KEYis a dict comprehension and picks it up. Verified the MP3/MP4 mappings are unshifted (title→TIT2/©nam,album→TALB/©alb,isrc→TSRC/…).{tracktotal}and{version}for folder_formatVersion alone is not always enough. The two editions that collided for me are both called "Deluxe Edition":
vegp0b121e5itgrid9ukxx5fx1Every existing key is identical across those two.
{tracktotal}tells them apart and stays readable, which{id}— the only currently-unique option — does not:Both are now exposed to
folder_format, alongside the existing keys.Compatibility note
Folding the version into the title changes folder names for releases that have one, so an existing library will not match what this generates. Nothing breaks day to day, since the downloads database prevents re-downloading, but re-fetching an album can create a second folder under the new naming. Worth deciding deliberately — I think the collision is the worse problem, but it is a behaviour change rather than a pure fix, and I am happy to put the title change behind an option if you would prefer.
{tracktotal}and{version}on their own are purely additive: nothing changes unless they are added tofolder_format.Testing
Both editions resolved from live metadata:
pytest tests/unchanged: 59 passed, 1 failed, and that failure (test_meta.py::test_album_metadata_qobuz, a genre assertion) also fails on an unmodifieddev.