Move reclassified singles to singles grid, fix collectors edition matching
- 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
This commit is contained in:
parent
7ea5eb2c06
commit
1455112d40
2 changed files with 24 additions and 14 deletions
|
|
@ -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})",
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue