fix missing list
This commit is contained in:
24
script.js
24
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 => {
|
||||
|
||||
Reference in New Issue
Block a user