Allow duplicate tracks across albums with settings toggle
Same song from different albums was blocked from entering the wishlist by a name+artist dedup check. Added toggle in Settings → Library → File Organization: "Allow duplicate tracks across albums" (on by default). When enabled, the dedup is skipped — different album versions of the same song can coexist in the wishlist for complete discography downloads. The UNIQUE constraint on track ID still prevents the exact same track from being added twice.
This commit is contained in:
parent
2f4ff8213f
commit
0bc6abd683
3 changed files with 58 additions and 41 deletions
|
|
@ -6058,7 +6058,10 @@ class MusicDatabase:
|
||||||
logger.info(f"Wishlist add: missing album name for '{track_name}', using track name as fallback")
|
logger.info(f"Wishlist add: missing album name for '{track_name}', using track name as fallback")
|
||||||
|
|
||||||
# Check for duplicates by track name + artist (not just Spotify ID)
|
# Check for duplicates by track name + artist (not just Spotify ID)
|
||||||
# This prevents adding the same track multiple times with different IDs or edge cases
|
# When allow_duplicates is True (default), same song from different albums can coexist
|
||||||
|
allow_duplicates = config_manager.get('wishlist.allow_duplicate_tracks', True)
|
||||||
|
|
||||||
|
if not allow_duplicates:
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
SELECT id, spotify_track_id, spotify_data FROM wishlist_tracks
|
SELECT id, spotify_track_id, spotify_data FROM wishlist_tracks
|
||||||
WHERE profile_id = ?
|
WHERE profile_id = ?
|
||||||
|
|
|
||||||
|
|
@ -4660,6 +4660,16 @@
|
||||||
Full artist list is always preserved in file metadata tags.</small>
|
Full artist list is always preserved in file metadata tags.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" id="allow-duplicate-tracks" checked>
|
||||||
|
Allow duplicate tracks across albums
|
||||||
|
</label>
|
||||||
|
<small class="settings-hint">When enabled, the same song can be added to the wishlist from
|
||||||
|
different albums (e.g., completing a discography where albums share tracks).
|
||||||
|
When disabled, tracks with the same name and artist are skipped.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="test-button" onclick="resetFileOrganizationTemplates()"
|
<button class="test-button" onclick="resetFileOrganizationTemplates()"
|
||||||
style="background: #666;">
|
style="background: #666;">
|
||||||
|
|
|
||||||
|
|
@ -5832,6 +5832,7 @@ async function loadSettingsData() {
|
||||||
document.getElementById('template-playlist-path').value = settings.file_organization?.templates?.playlist_path || '$playlist/$artist - $title';
|
document.getElementById('template-playlist-path').value = settings.file_organization?.templates?.playlist_path || '$playlist/$artist - $title';
|
||||||
document.getElementById('disc-label').value = settings.file_organization?.disc_label || 'Disc';
|
document.getElementById('disc-label').value = settings.file_organization?.disc_label || 'Disc';
|
||||||
document.getElementById('collab-artist-mode').value = settings.file_organization?.collab_artist_mode || 'first';
|
document.getElementById('collab-artist-mode').value = settings.file_organization?.collab_artist_mode || 'first';
|
||||||
|
document.getElementById('allow-duplicate-tracks').checked = settings.wishlist?.allow_duplicate_tracks !== false;
|
||||||
|
|
||||||
// Populate Playlist Sync settings
|
// Populate Playlist Sync settings
|
||||||
document.getElementById('create-backup').checked = settings.playlist_sync?.create_backup !== false;
|
document.getElementById('create-backup').checked = settings.playlist_sync?.create_backup !== false;
|
||||||
|
|
@ -6860,6 +6861,9 @@ async function saveSettings(quiet = false) {
|
||||||
playlist_path: document.getElementById('template-playlist-path').value
|
playlist_path: document.getElementById('template-playlist-path').value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
wishlist: {
|
||||||
|
allow_duplicate_tracks: document.getElementById('allow-duplicate-tracks').checked
|
||||||
|
},
|
||||||
playlist_sync: {
|
playlist_sync: {
|
||||||
create_backup: document.getElementById('create-backup').checked
|
create_backup: document.getElementById('create-backup').checked
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue