From 01469c1b06643efcee23c9b8577a2634fc41a91f Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Sat, 27 Sep 2025 02:30:02 +0200 Subject: [PATCH] fix missing list --- script.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index 2892816..84b2ae9 100644 --- a/script.js +++ b/script.js @@ -166,14 +166,28 @@ const isInEasterPeriod = (currentDate, easter) => { }; // Get the appropriate list filename based on season -const getSeasonalListFileName = () => { +const getSeasonalListFileName = async () => { const season = getCurrentSeason(); if (!season || !seasonalLists[season]) { console.log('Using default list:', listFileName); return listFileName; } - console.log(`Using seasonal list for ${season}:`, seasonalLists[season]); - return seasonalLists[season]; + + // Check if seasonal file exists + const seasonalFile = seasonalLists[season]; + try { + const response = await fetch(seasonalFile + '?' + new Date().getTime(), { method: 'HEAD' }); + if (response.ok) { + console.log(`Using seasonal list for ${season}:`, seasonalFile); + return seasonalFile; + } else { + console.warn(`Seasonal file ${seasonalFile} not found, falling back to default list:`, listFileName); + return listFileName; + } + } catch (error) { + console.warn(`Error checking seasonal file ${seasonalFile}:`, error.message, '- falling back to default list:', listFileName); + return listFileName; + } }; // Get SponsorBlock-Data for the outro/intro segment of the trailer @@ -764,8 +778,8 @@ const checkBackdropAndLogo = movie => { ).catch(() => fetchRandomMovie()); }; -const readCustomList = () => { - const currentListFile = getSeasonalListFileName(); +const readCustomList = async () => { + const currentListFile = await getSeasonalListFileName(); return fetch(currentListFile + '?' + new Date().getTime()) .then(response => response.ok ? response.text() : null) .then(text => {