From 1455112d409439629558ecb692b6cbc53346e7ec Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Thu, 2 Apr 2026 19:22:23 -0700 Subject: [PATCH] Move reclassified singles to singles grid, fix collectors edition matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Cards reclassified from album to single/EP (via lazy track count) now physically move from albums-grid to singles-grid - Singles section auto-shows when cards move into it - Add collectors edition to album title variation patterns — fixes "Damn" not matching "DAMN. COLLECTORS EDITION." in library - Both base-title-to-edition and edition-to-base variations now include collectors edition alongside deluxe/platinum/special --- database/music_database.py | 8 +++++--- webui/static/script.js | 30 +++++++++++++++++++----------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/database/music_database.py b/database/music_database.py index c434cd8a..bf1c06bf 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -5454,10 +5454,12 @@ class MusicDatabase: 'deluxe', 'platinum edition', 'platinum', - 'special edition', + 'special edition', 'expanded edition', 'remastered', - 'anniversary edition' + 'anniversary edition', + "collector's edition", + 'collectors edition', ] for edition in common_editions: @@ -5471,7 +5473,7 @@ class MusicDatabase: # If original title is base form, add edition variants elif not any(re.search(pattern, title_lower) for pattern in edition_patterns.keys()): # This appears to be a base album, add deluxe variants - common_editions = ['Deluxe Edition', 'Deluxe', 'Platinum Edition', 'Special Edition'] + common_editions = ['Deluxe Edition', 'Deluxe', 'Platinum Edition', 'Special Edition', "Collector's Edition", 'Collectors Edition'] for edition in common_editions: variations.extend([ f"{title} ({edition})", diff --git a/webui/static/script.js b/webui/static/script.js index 844bfb87..847a0f41 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -34371,21 +34371,29 @@ function updateAlbumCompletionOverlay(completionData, containerType) { return; } - // Reclassify album type if we now know the track count (Discogs lazy fetch) + // Reclassify and move cards when track count reveals single/EP (Discogs lazy fetch) const currentType = albumCard.dataset.albumType; const expectedTracks = completionData.expected_tracks || 0; - if (currentType === 'album' && expectedTracks > 0 && expectedTracks <= 3) { - albumCard.dataset.albumType = 'single'; - const typeEl = albumCard.querySelector('.album-card-type'); - if (typeEl) typeEl.textContent = 'Single'; - } else if (currentType === 'album' && expectedTracks > 3 && expectedTracks <= 6) { - albumCard.dataset.albumType = 'ep'; - const typeEl = albumCard.querySelector('.album-card-type'); - if (typeEl) typeEl.textContent = 'EP'; - } - // Update stored total tracks if (expectedTracks > 0) { albumCard.dataset.totalTracks = expectedTracks; + let newType = currentType; + if (currentType === 'album' && expectedTracks <= 3) newType = 'single'; + else if (currentType === 'album' && expectedTracks <= 6) newType = 'ep'; + + if (newType !== currentType) { + albumCard.dataset.albumType = newType; + const typeEl = albumCard.querySelector('.album-card-type'); + if (typeEl) typeEl.textContent = newType === 'single' ? 'Single' : 'EP'; + + // Move card from albums grid to singles grid + const singlesGrid = document.getElementById('singles-grid'); + const singlesSection = singlesGrid?.closest('.discography-section'); + if (singlesGrid) { + albumCard.remove(); + singlesGrid.appendChild(albumCard); + if (singlesSection) singlesSection.style.display = ''; + } + } } const overlay = albumCard.querySelector('.completion-overlay');