fix missing list

This commit is contained in:
CodeDevMLH
2025-09-27 02:30:02 +02:00
parent 8f92dcaca3
commit 01469c1b06

View File

@@ -166,14 +166,28 @@ const isInEasterPeriod = (currentDate, easter) => {
}; };
// Get the appropriate list filename based on season // Get the appropriate list filename based on season
const getSeasonalListFileName = () => { const getSeasonalListFileName = async () => {
const season = getCurrentSeason(); const season = getCurrentSeason();
if (!season || !seasonalLists[season]) { if (!season || !seasonalLists[season]) {
console.log('Using default list:', listFileName); console.log('Using default list:', listFileName);
return 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 // Get SponsorBlock-Data for the outro/intro segment of the trailer
@@ -764,8 +778,8 @@ const checkBackdropAndLogo = movie => {
).catch(() => fetchRandomMovie()); ).catch(() => fetchRandomMovie());
}; };
const readCustomList = () => { const readCustomList = async () => {
const currentListFile = getSeasonalListFileName(); const currentListFile = await getSeasonalListFileName();
return fetch(currentListFile + '?' + new Date().getTime()) return fetch(currentListFile + '?' + new Date().getTime())
.then(response => response.ok ? response.text() : null) .then(response => response.ok ? response.text() : null)
.then(text => { .then(text => {