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');