Remove secondary artist recording from track imports #41

Open
opened 2026-03-21 14:14:06 -04:00 by connor · 0 comments
Owner

Description:

Currently, when a track has multiple artist credits on MusicBrainz (e.g., "Artist A feat. Artist B"), the tagger creates separate artist records in the DB for secondary/collaborating artists. This is done via extract_secondary_artists() in shanty-data/src/musicbrainz.rs, which walks the MusicBrainz artist credit array beyond the first entry and records non-"featuring" collaborators. The secondary_artists field on RecordingDetails (in shanty-data/src/types.rs) carries these through to the tagger in shanty-tag/src/tagger.rs, which then calls queries::artists::upsert() for each secondary artist.

This clutters the library with artists that the user didn't intentionally add — they show up in the library view, artist list, Subsonic browsing, and playlist artist picker.

What to change

  1. shanty-data/src/musicbrainz.rs: Remove the extract_secondary_artists() function entirely. Remove the call to it in the get_recording() method (in the MetadataFetcher impl).

  2. shanty-data/src/types.rs: Remove the secondary_artists: Vec<(String, String)> field from the RecordingDetails struct.

  3. shanty-tag/src/tagger.rs: Remove any code that iterates over recording.secondary_artists and creates artist DB records for them. The tagger should only create/upsert the single primary artist.

  4. shanty-tag/tests/integration.rs and shanty-watch/tests/integration.rs: Update any test mocks that set secondary_artists on RecordingDetails — change to secondary_artists: vec![] or remove the field entirely after the struct change.

  5. Consider a cleanup migration or manual SQL: Existing secondary artist records in the DB won't be automatically removed. Either add a migration that deletes artists with no wanted items and no tracks, or document a manual cleanup query.

Acceptance criteria:

  • extract_secondary_artists() removed from musicbrainz.rs
  • secondary_artists field removed from RecordingDetails
  • Tagger only creates DB records for the primary artist
  • No secondary artist DB records created during tagging or downloading
  • All tests pass after the change
  • Library view only shows intentionally added artists
**Description:** Currently, when a track has multiple artist credits on MusicBrainz (e.g., "Artist A feat. Artist B"), the tagger creates separate artist records in the DB for secondary/collaborating artists. This is done via `extract_secondary_artists()` in `shanty-data/src/musicbrainz.rs`, which walks the MusicBrainz artist credit array beyond the first entry and records non-"featuring" collaborators. The `secondary_artists` field on `RecordingDetails` (in `shanty-data/src/types.rs`) carries these through to the tagger in `shanty-tag/src/tagger.rs`, which then calls `queries::artists::upsert()` for each secondary artist. This clutters the library with artists that the user didn't intentionally add — they show up in the library view, artist list, Subsonic browsing, and playlist artist picker. ### What to change 1. **`shanty-data/src/musicbrainz.rs`**: Remove the `extract_secondary_artists()` function entirely. Remove the call to it in the `get_recording()` method (in the `MetadataFetcher` impl). 2. **`shanty-data/src/types.rs`**: Remove the `secondary_artists: Vec<(String, String)>` field from the `RecordingDetails` struct. 3. **`shanty-tag/src/tagger.rs`**: Remove any code that iterates over `recording.secondary_artists` and creates artist DB records for them. The tagger should only create/upsert the single primary artist. 4. **`shanty-tag/tests/integration.rs`** and **`shanty-watch/tests/integration.rs`**: Update any test mocks that set `secondary_artists` on `RecordingDetails` — change to `secondary_artists: vec![]` or remove the field entirely after the struct change. 5. **Consider a cleanup migration or manual SQL**: Existing secondary artist records in the DB won't be automatically removed. Either add a migration that deletes artists with no wanted items and no tracks, or document a manual cleanup query. **Acceptance criteria:** - [ ] `extract_secondary_artists()` removed from musicbrainz.rs - [ ] `secondary_artists` field removed from `RecordingDetails` - [ ] Tagger only creates DB records for the primary artist - [ ] No secondary artist DB records created during tagging or downloading - [ ] All tests pass after the change - [ ] Library view only shows intentionally added artists
connor added the MediumPriority label 2026-03-21 14:19:37 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Shanty/Main#41