Add Exclude Seasonal Content option to configuration and update related logic
This commit is contained in:
@@ -66,6 +66,7 @@ const CONFIG = {
|
||||
sortOrder: "Ascending",
|
||||
applyLimitsToCustomIds: false,
|
||||
seasonalSections: "[]",
|
||||
excludeSeasonalContent: true,
|
||||
isEnabled: true,
|
||||
};
|
||||
|
||||
@@ -1125,9 +1126,43 @@ const ApiUtils = {
|
||||
pastDate.setDate(pastDate.getDate() - CONFIG.maxDaysRecent);
|
||||
dateFilter = `&minDateLastSaved=${pastDate.toISOString()}`;
|
||||
}
|
||||
|
||||
// Exclude seasonal content from random lists
|
||||
let excludeFilter = '';
|
||||
if (CONFIG.excludeSeasonalContent && CONFIG.seasonalSections) {
|
||||
try {
|
||||
const sections = JSON.parse(CONFIG.seasonalSections || "[]");
|
||||
let allExcludedIds = [];
|
||||
|
||||
for (const section of sections) {
|
||||
if (section.MediaIds) {
|
||||
const idsInThisSection = section.MediaIds.split(/[\n,]/)
|
||||
.map((line) => {
|
||||
const urlMatch = line.match(/\[(.*?)\]/);
|
||||
let id = line;
|
||||
if (urlMatch) {
|
||||
id = line.replace(/\[.*?\]/, '').trim();
|
||||
const guidMatch = id.match(/([0-9a-f]{32})/i);
|
||||
if (guidMatch) { id = guidMatch[1]; } else { id = id.split('|')[0].trim(); }
|
||||
}
|
||||
return id.trim();
|
||||
})
|
||||
.filter((id) => id);
|
||||
|
||||
allExcludedIds.push(...idsInThisSection);
|
||||
}
|
||||
}
|
||||
|
||||
if (allExcludedIds.length > 0) {
|
||||
excludeFilter = `&ExcludeItemIds=${allExcludedIds.join(',')}`;
|
||||
}
|
||||
} catch(e) {
|
||||
console.error("🎬 Media Bar:", "Error extracting seasonal IDs for exclusion:", e);
|
||||
}
|
||||
}
|
||||
|
||||
const fetchItems = async (currentDateFilter) => {
|
||||
const url = `${STATE.jellyfinData.serverAddress}/Items?IncludeItemTypes=Movie,Series&Recursive=true&hasOverview=true&imageTypes=Logo,Backdrop&${sortParams}${playedFilter}${parentalFilter}${currentDateFilter}&enableUserData=true&Limit=${CONFIG.maxItems}&fields=Id,DateCreated`;
|
||||
const url = `${STATE.jellyfinData.serverAddress}/Items?IncludeItemTypes=Movie,Series&Recursive=true&hasOverview=true&imageTypes=Logo,Backdrop&${sortParams}${playedFilter}${parentalFilter}${currentDateFilter}${excludeFilter}&enableUserData=true&Limit=${CONFIG.maxItems}&fields=Id,DateCreated`;
|
||||
const resp = await fetch(url, { headers: this.getAuthHeaders() });
|
||||
return resp;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user