diff --git a/src/auto_scheduler/mrss.ts b/src/auto_scheduler/mrss.ts index 424f1b3..d796626 100644 --- a/src/auto_scheduler/mrss.ts +++ b/src/auto_scheduler/mrss.ts @@ -214,7 +214,7 @@ export class MRSSAutoScheduler { let scheduleEventsToAdd: ScheduleEvent[] = []; let nextStartTime = findLastEndTime(ongoingAndFutureScheduleEvents, now); for (let i = 0; i < numberOfScheduleEvents; i++) { - let asset = assets[Math.floor(Math.random() * assets.length)]; + let asset = assets[i]; if (asset) { const totalScheduleEventDuration = asset.duration; const nextEndTime = nextStartTime + totalScheduleEventDuration * 1000; diff --git a/src/models/mrssFeedModel.ts b/src/models/mrssFeedModel.ts index e8d07da..2db75c2 100644 --- a/src/models/mrssFeedModel.ts +++ b/src/models/mrssFeedModel.ts @@ -27,6 +27,8 @@ export interface MRSSAsset { title: string; url: string; duration: number; + start_time: number; + end_time: number; } interface MRSSCache { @@ -164,14 +166,18 @@ export class MRSSFeed { if (cachedAsset) { cachedAsset.title = feedEntry.title; cachedAsset.url = feedEntry.link; - cachedAsset.duration = -1; + cachedAsset.duration = feedEntry.duration ? feedEntry.duration : -1 ; + cachedAsset.start_time= feedEntry.start_time; + cachedAsset.end_time = feedEntry.endTime; } else { debug("Adding new entry to cache"); this.cache.assets.push({ id: feedEntry.id, title: feedEntry.title, url: feedEntry.link, - duration: -1, + duration: feedEntry.duration ? feedEntry.duration : -1, + start_time: feedEntry.start_time, + end_time: feedEntry.end_time, }); } }