discover progress

This commit is contained in:
Broque Thomas 2025-11-17 08:49:49 -08:00
parent 5a13b5fe94
commit ee266920a9
4 changed files with 50 additions and 223 deletions

View file

@ -111,11 +111,30 @@ class PersonalizedPlaylistsService:
logger.warning(f"No tracks found for {decade}s")
return []
# Apply diversity constraint: max 3 tracks per album, max 4 per artist
# Shuffle first for randomness
import random
random.shuffle(all_tracks)
# Count unique artists to determine diversity level
unique_artists = len(set(track['artist_name'] for track in all_tracks))
# Adaptive diversity limits based on artist variety
if unique_artists >= 20:
# Good variety - apply diversity constraints
max_per_album = 3
max_per_artist = 5
elif unique_artists >= 10:
# Moderate variety - more lenient
max_per_album = 4
max_per_artist = 8
else:
# Low variety - very lenient to hit 50 tracks
max_per_album = 5
max_per_artist = 12
logger.info(f"{decade}s has {unique_artists} unique artists - using limits: {max_per_album} per album, {max_per_artist} per artist")
# Apply diversity constraints
tracks_by_album = {}
tracks_by_artist = {}
diverse_tracks = []
@ -128,8 +147,7 @@ class PersonalizedPlaylistsService:
album_count = tracks_by_album.get(album, 0)
artist_count = tracks_by_artist.get(artist, 0)
# Apply more lenient limits: max 3 per album, max 4 per artist
if album_count < 3 and artist_count < 4:
if album_count < max_per_album and artist_count < max_per_artist:
diverse_tracks.append(track)
tracks_by_album[album] = album_count + 1
tracks_by_artist[artist] = artist_count + 1
@ -137,7 +155,7 @@ class PersonalizedPlaylistsService:
if len(diverse_tracks) >= limit:
break
logger.info(f"Found {len(diverse_tracks)} tracks from {decade}s in discovery pool (with diversity filtering)")
logger.info(f"Found {len(diverse_tracks)} tracks from {decade}s in discovery pool (adaptive diversity)")
return diverse_tracks[:limit]
except Exception as e:

View file

@ -2071,17 +2071,6 @@
</div>
</div>
</div>
<!-- Quick Picks Section -->
<div class="discover-section">
<div class="discover-section-header">
<h2 class="discover-section-title">⚡ Quick Picks</h2>
<p class="discover-section-subtitle">Jump into curated experiences</p>
</div>
<div class="quick-picks-grid" id="quick-picks-grid">
<!-- Content will be populated dynamically -->
</div>
</div>
</div>
</div>

View file

@ -24742,8 +24742,7 @@ async function loadDiscoverPage() {
loadPersonalizedForgottenFavorites(), // NEW: Forgotten favorites
loadDiscoveryShuffle(), // NEW: Discovery Shuffle
loadFamiliarFavorites(), // NEW: Familiar Favorites
loadDecadeBrowser(), // Decade browser
loadQuickPicks() // Quick picks action cards
loadDecadeBrowser() // Decade browser
]);
// Check for active syncs after page load
@ -25275,17 +25274,20 @@ async function loadDecadeBrowser() {
return;
}
// Build decade cards from available decades
// Build decade cards matching Recent Releases style
let html = '';
data.decades.forEach(decade => {
const icon = getDecadeIcon(decade.year);
const label = `${decade.year}s`;
html += `
<div class="decade-card" onclick="openDecadePlaylist(${decade.year})">
<div class="decade-card-content">
<div class="decade-icon">${icon}</div>
<div class="decade-year">${label}</div>
<div class="decade-title">${decade.track_count} tracks</div>
<div class="discover-card decade-card-modern" onclick="openDecadePlaylist(${decade.year})">
<div class="discover-card-image decade-card-image">
<div class="decade-icon-large">${icon}</div>
</div>
<div class="discover-card-info">
<h4 class="discover-card-title">${label}</h4>
<p class="discover-card-subtitle">${decade.track_count} tracks</p>
<p class="discover-card-meta">Classics</p>
</div>
</div>
`;
@ -25350,87 +25352,6 @@ async function openDecadePlaylist(decade) {
}
}
// ===============================
// QUICK PICKS
// ===============================
function loadQuickPicks() {
try {
const grid = document.getElementById('quick-picks-grid');
if (!grid) return;
const quickPicks = [
{
icon: '🎲',
title: 'Surprise Me',
description: 'Shuffle your discovery pool',
gradient: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
action: 'scrollToSection("personalized-discovery-shuffle")'
},
{
icon: '🔥',
title: 'Trending Now',
description: 'High popularity discoveries',
gradient: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
action: 'scrollToSection("personalized-popular-picks")'
},
{
icon: '💎',
title: 'Deep Cuts',
description: 'Underground hidden gems',
gradient: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
action: 'scrollToSection("personalized-hidden-gems")'
},
{
icon: '⏰',
title: 'Time Machine',
description: 'Browse by decade',
gradient: 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)',
action: 'scrollToSection("decade-browser-carousel")'
}
];
let html = '';
quickPicks.forEach(pick => {
html += `
<div class="quick-pick-card" onclick="${pick.action}" style="background: ${pick.gradient};">
<div class="quick-pick-icon">${pick.icon}</div>
<h3 class="quick-pick-title">${pick.title}</h3>
<p class="quick-pick-description">${pick.description}</p>
</div>
`;
});
grid.innerHTML = html;
} catch (error) {
console.error('Error loading quick picks:', error);
}
}
function scrollToSection(sectionId) {
const section = document.getElementById(sectionId);
if (!section) {
console.warn(`Section not found: ${sectionId}`);
return;
}
// Show section if it's hidden
const parentSection = section.closest('.discover-section');
if (parentSection) {
const currentDisplay = window.getComputedStyle(parentSection).display;
if (currentDisplay === 'none') {
parentSection.style.display = 'block';
console.log(`Showing hidden section: ${sectionId}`);
}
}
// Wait a tick for layout, then scroll
setTimeout(() => {
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 100);
}
// ===============================
// SEASONAL DISCOVERY
// ===============================

View file

@ -17296,147 +17296,46 @@ body {
}
/* =======================
QUICK PICKS SECTION
DECADE BROWSER SECTION - Modern Style matching Recent Releases
======================= */
.quick-picks-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
margin-top: 16px;
.decade-card-modern {
/* Inherits from .discover-card */
}
.quick-pick-card {
position: relative;
padding: 32px 24px;
border-radius: 16px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
}
.quick-pick-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: inherit;
opacity: 0.9;
transition: opacity 0.3s ease;
}
.quick-pick-card:hover::before {
opacity: 1;
}
.quick-pick-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.quick-pick-icon {
position: relative;
font-size: 48px;
margin-bottom: 16px;
z-index: 1;
}
.quick-pick-title {
position: relative;
font-size: 20px;
font-weight: 700;
color: #fff;
margin: 0 0 8px 0;
z-index: 1;
}
.quick-pick-description {
position: relative;
font-size: 14px;
color: rgba(255, 255, 255, 0.8);
margin: 0;
z-index: 1;
}
/* =======================
DECADE BROWSER SECTION
======================= */
.decade-card {
position: relative;
width: 100%;
aspect-ratio: 1;
border-radius: 16px;
overflow: hidden;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
.decade-card-image {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.decade-card:hover {
transform: translateY(-8px) scale(1.02);
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.decade-card-content {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
padding: 24px;
background: linear-gradient(135deg,
rgba(102, 126, 234, 0.15) 0%,
rgba(118, 75, 162, 0.15) 100%);
position: relative;
overflow: hidden;
}
.decade-card::before {
.decade-card-image::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
opacity: 0;
background: linear-gradient(135deg,
rgba(102, 126, 234, 0.1) 0%,
rgba(118, 75, 162, 0.1) 100%);
opacity: 1;
transition: opacity 0.3s ease;
}
.decade-card:hover::before {
opacity: 0.2;
.decade-card-modern:hover .decade-card-image::before {
opacity: 0.3;
}
.decade-icon {
position: relative;
font-size: 80px;
.decade-icon-large {
font-size: 96px;
line-height: 1;
position: relative;
z-index: 1;
transition: transform 0.3s ease;
}
.decade-card:hover .decade-icon {
transform: scale(1.1);
}
.decade-year {
position: relative;
font-size: 36px;
font-weight: 900;
color: #fff;
text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
letter-spacing: -1px;
z-index: 1;
}
.decade-title {
position: relative;
font-size: 16px;
font-weight: 600;
color: rgba(255, 255, 255, 0.7);
text-transform: uppercase;
letter-spacing: 2px;
z-index: 1;
.decade-card-modern:hover .decade-icon-large {
transform: scale(1.1) rotate(5deg);
}