Add bitrate-based 'upgrade' duplicate_action#6842
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6842 +/- ##
==========================================
+ Coverage 75.63% 75.69% +0.05%
==========================================
Files 163 163
Lines 21317 21417 +100
Branches 3361 3385 +24
==========================================
+ Hits 16124 16211 +87
- Misses 4403 4408 +5
- Partials 790 798 +8
🚀 New features to boost your workflow:
|
| # else: a second old album also has survivors; an item can | ||
| # only belong to one album, so leave it untouched rather than | ||
| # arbitrarily choosing between two candidates. |
There was a problem hiding this comment.
I think we need a better option than just ignoring it. If you have multiple albums, it won't be clear which gets upgraded and it might result in a downgrade in some situations.
There was a problem hiding this comment.
I think the safest behavior would be to automatically decline the upgrade in that case (falling back to skip), because any merge would otherwise pick an arbitrary destination. What is the preferred rule you have in mind here?
There was a problem hiding this comment.
One option would be to keep the assignments for duplicate albums from the upgrade. That means that multiple, different files could be upgraded in different on-filesystem albums, even if they are duplicate items
For example, let's say that we have two existing albums: Album A, which is mostly 320kbps with some 24bit FLAC; and Album B, which is just 320kbps. Now if we import a 16bit FLAC album as a replacement with upgrade, then we will have a problem. Almost all of the files will be counted as an upgrade with both albums. But because of Album B, all of the files will be included in the upgrade list.
Now, if Album A is returned first because of the dict (which I believe will actually be somewhat random) then we will actually be downgrading all those 24bit FLAC files because we can't distinguish between which versions of existing albums we should be upgrading.
But if we keep those assignments, we can upgrade each duplicate album separately to ensure that, overall, there is no downgrades.
There was a problem hiding this comment.
I went with your suggested approach: resolve_upgrade now runs independently against each duplicate album (as if it were the only one), and only the album with the most overlap (most superseded tracks, then most kept tracks, then lowest album ID as a tie-breaker) is treated as the upgrade target. Every other candidate album, including any higher-bitrate tracks in it, is untouched, since a given new track can only ever join one physical album.
For your example: Album A (mostly 320kbps + some 24-bit FLAC) and Album B (all 320kbps) both matching a 16-bit FLAC reimport — Album B would be resolved and upgraded on its own since it has more overlap, and Album A's 24-bit FLAC tracks are never touched or considered for supersession at all.
Adds an
upgradeoption forduplicate_action(config-only, not offered in the interactiveaskprompt). When set, each newly imported track is compared against any existing duplicate with the sameduplicate_keys:This picks up the idea from #4471 by @Serene-Arc, which stalled. The importer has been substantially refactored since then, so many of the issues identified earlier are not relevant, but the design follows what was agreed there: config-only, bitrate-based comparison, no per-track album splitting as a decision mechanism.
Would appreciate some 👀 on this.
docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)