diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 566badf..e7ae852 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -62,46 +62,30 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { videos: folxStadlVideos.slice(0, 12) }] : []), { - title: "GDL VIDEO", + title: "VIDEO", videos: (() => { - // Filter videos that are only Geschichte des Liedes (exclude FOLX STADL and Gipfelstammtisch) - const artistVideos = videos.filter(video => - !video.title.includes("FOLX STADL") && - !video.title.includes("FOLXSTADL") && - !video.title.includes("Gipfelstammtisch") + // Filter videos that specifically contain "Geschichte des Liedes VIDEO" in title or description + const videoVideos = videos.filter(video => + video.title.toLowerCase().includes("geschichte des liedes video") || + video.description?.toLowerCase().includes("geschichte des liedes video") ); - // Group by performer/artist (extract performer name before " - ") - const performerGroups: { [key: string]: typeof videos } = {}; - artistVideos.forEach(video => { - const performer = video.title.split(" - ")[0] || "Unknown"; - if (!performerGroups[performer]) { - performerGroups[performer] = []; - } - performerGroups[performer].push(video); - }); - - // Sort each group by upload date (newest first) - Object.keys(performerGroups).forEach(performer => { - performerGroups[performer].sort((a, b) => - new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + // If no specific "Geschichte des Liedes VIDEO" videos found, fallback to general filter + if (videoVideos.length === 0) { + const fallbackVideos = videos.filter(video => + !video.title.includes("FOLX STADL") && + !video.title.includes("FOLXSTADL") && + !video.title.includes("Gipfelstammtisch") ); - }); - - // Distribute videos: first one from each performer, then continue - const result = []; - const performers = Object.keys(performerGroups); - let maxRounds = Math.max(...performers.map(p => performerGroups[p].length)); - - for (let round = 0; round < maxRounds && result.length < 15; round++) { - for (let performer of performers) { - if (performerGroups[performer][round] && result.length < 15) { - result.push(performerGroups[performer][round]); - } - } + const shuffled = [...fallbackVideos].sort(() => Math.random() - 0.5); + return shuffled.slice(0, 15); } - return result; + // Shuffle the Geschichte des Liedes VIDEO videos randomly + const shuffled = [...videoVideos].sort(() => Math.random() - 0.5); + + // Return 15 random videos from the VIDEO collection + return shuffled.slice(0, 15); })() }, {