Add configuration options for custom ID limits

This commit is contained in:
CodeDevMLH
2026-02-13 00:50:34 +01:00
parent 9906784845
commit b613b028d0
3 changed files with 15 additions and 13 deletions

View File

@@ -57,6 +57,8 @@ const CONFIG = {
enableClientSideSettings: false,
sortBy: "Random",
sortOrder: "Ascending",
applyLimitsToCustomIds: false,
seasonalSections: "[]",
};
// State management
@@ -1781,11 +1783,7 @@ const SlideCreator = {
},
'onStateChange': (event) => {
if (event.data === YT.PlayerState.ENDED) {
if (CONFIG.waitForTrailerToEnd) {
SlideshowManager.nextSlide();
} else {
event.target.playVideo(); // Loop if not waiting for end if trailer is shorter than slide duration
}
}
},
'onError': (event) => {
@@ -1843,9 +1841,7 @@ const SlideCreator = {
});
backdrop.addEventListener('ended', () => {
if (CONFIG.waitForTrailerToEnd) {
SlideshowManager.nextSlide();
}
});
backdrop.addEventListener('error', () => {
@@ -3137,6 +3133,12 @@ const SlideshowManager = {
console.log("Using Custom Media IDs from configuration");
const rawIds = this.parseCustomIds();
itemIds = await this.resolveCollectionsAndItems(rawIds);
// Apply max items limit to custom IDs if enabled
if (CONFIG.applyLimitsToCustomIds && itemIds.length > CONFIG.maxItems) {
console.log(`Limiting custom IDs from ${itemIds.length} to ${CONFIG.maxItems}`);
itemIds = itemIds.slice(0, CONFIG.maxItems);
}
}
// 2. Try Avatar List (list.txt)