Skip to content

Added duduping on mb_trackid to the duplicates plugin#6313

Open
tommyschnabel wants to merge 4 commits into
beetbox:masterfrom
tommyschnabel:duplicates_import_actions
Open

Added duduping on mb_trackid to the duplicates plugin#6313
tommyschnabel wants to merge 4 commits into
beetbox:masterfrom
tommyschnabel:duplicates_import_actions

Conversation

@tommyschnabel
Copy link
Copy Markdown

Description

plugins/duplicates: dedupe_mb_trackid_on_import option added to deduplicate during imports based on already-imported mb_trackid.

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@tommyschnabel tommyschnabel requested a review from a team as a code owner January 23, 2026 21:06
@tommyschnabel tommyschnabel force-pushed the duplicates_import_actions branch from e419a56 to f8be4bb Compare January 23, 2026 21:14
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 20.83333% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.01%. Comparing base (3d3f5e3) to head (50152df).

Files with missing lines Patch % Lines
beetsplug/duplicates.py 20.83% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6313      +/-   ##
==========================================
- Coverage   72.07%   72.01%   -0.07%     
==========================================
  Files         159      159              
  Lines       20633    20656      +23     
  Branches     3273     3279       +6     
==========================================
+ Hits        14871    14875       +4     
- Misses       5053     5072      +19     
  Partials      709      709              
Files with missing lines Coverage Δ
beetsplug/tidal/__init__.py 85.32% <ø> (ø)
beetsplug/duplicates.py 19.68% <20.83%> (-0.32%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus snejus added the duplicates duplicates plugin label Apr 5, 2026
@tommyschnabel tommyschnabel requested a review from semohr as a code owner May 4, 2026 18:18
@tommyschnabel tommyschnabel force-pushed the duplicates_import_actions branch 3 times, most recently from b8639a6 to d706aad Compare May 4, 2026 19:02
@tommyschnabel tommyschnabel force-pushed the duplicates_import_actions branch from d706aad to 50152df Compare May 4, 2026 20:27
@snejus
Copy link
Copy Markdown
Member

snejus commented May 6, 2026

I think this addresses a real user problem, but it lands in the wrong architectural layer.

The duplicates plugin is currently scoped as a command plugin (beet duplicates) for inspecting and acting on duplicates already in the library (docs/plugins/duplicates.rst, beetsplug/duplicates.py). This PR adds import-time policy via import_task_created in beetsplug/duplicates.py, which changes importer behavior before core duplicate resolution runs.

Duplicate policy already has a clear owner in importer core: import.duplicate_keys, import.duplicate_action, and _resolve_duplicates() (docs/reference/config.rst, beets/ importer/stages.py). Splitting duplicate policy between importer core and the duplicates plugin will make behavior harder to reason about, harder to test, and less predictable for users.

Could we move this into importer core instead?

  • Add importer-level support for track-level duplicate checks during album imports (config-driven).
  • Reuse the existing duplicate action flow (skip/keep/remove/merge/ask) so UX and semantics stay consistent.
  • Keep duplicates focused on post-import library analysis/actions via beet duplicates.

@tommyschnabel
Copy link
Copy Markdown
Author

@snejus thanks for the feedback! Not super familiar with the entire project structure, so it's not surprising that this changeset doesn't fit in the duplicates plugin 😅

I'll move it to the importer 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicates duplicates plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants