Skip to content

Commit

Permalink
fixed the property names add like vod restrore
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxx committed May 12, 2023
1 parent af09066 commit 7522bd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
21 changes: 10 additions & 11 deletions src/auto_scheduler/mrss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export class MRSSAutoScheduler {

// insert demo feed if not exists
async bootstrap(demoTenant: string) {
return
const availableFeeds = await this.feedsDb.listAll();
if (availableFeeds.find(feed => feed.id === "eyevinn")) {
debug("Demo feed already available");
Expand Down Expand Up @@ -207,7 +206,7 @@ export class MRSSAutoScheduler {
const assets = feed.getAssets();
const scheduleEvents = await this.scheduleEventsDb.getScheduleEventsByChannelId(feed.channelId, {
start: now.subtract(2 * 60 * 60, "second").valueOf(),
// end: now.add(12 * 60 * 60, "second").valueOf(),
end: now.add(12 * 60 * 60, "second").valueOf(),
});
const ongoingAndFutureScheduleEvents = findOngoingAndFutureEvents(scheduleEvents, now);
if (ongoingAndFutureScheduleEvents.length <= 4) {
Expand All @@ -217,36 +216,36 @@ export class MRSSAutoScheduler {
let asset = assets[i];
if (asset) {
const totalScheduleEventDuration = asset.duration;
/*
const nextStartTime = asset.start_time;
const nextEndTime = asset.end_time;
if (feed.shouldInsertLive) {
console.log(`[${feed.channelId}]: Adding schedule event (${ScheduleEventType.LIVE}): url=${asset.url}, start=${asset.start_time}, end=${asset.end_time}`);
console.log(`[${feed.channelId}]: Adding schedule event (${ScheduleEventType.LIVE}): url=${feed.liveUrl}, start=${new Date(nextStartTime).toISOString()}, end=${new Date(nextEndTime).toISOString()}`);
scheduleEventsToAdd.push(new ScheduleEvent({
id: uuidv4(),
channelId: feed.channelId,
title: "LIVE EVENT",
duration: totalScheduleEventDuration,
start_time: asset.start_time,
end_time: asset.end_time,
start_time: nextStartTime,
end_time: nextEndTime,
url: asset.url,
liveUrl: feed.liveUrl,
type: ScheduleEventType.LIVE,
}));
feed.resetLiveEventCountdown();
} else {
*/
console.log(`[${feed.channelId}]: Adding schedule event (${ScheduleEventType.VOD}): url=${asset.url}, start=${asset.start_time}, end=${asset.end_time}`);
console.log(`[${feed.channelId}]: Adding schedule event (${ScheduleEventType.VOD}): title=${asset.title}, start=${new Date(nextStartTime).toISOString()}, end=${new Date(nextEndTime).toISOString()}`);
scheduleEventsToAdd.push(new ScheduleEvent({
id: uuidv4(),
channelId: feed.channelId,
title: asset.title,
duration: totalScheduleEventDuration,
start_time: asset.start_time,
end_time: asset.end_time,
start_time: nextStartTime,
end_time: nextEndTime,
url: asset.url,
type: ScheduleEventType.VOD,
}));
feed.decreaseLiveEventCountdown();
//}
}
}
}
for (const scheduleEvent of scheduleEventsToAdd) {
Expand Down
6 changes: 2 additions & 4 deletions src/models/mrssFeedModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ export class MRSSFeed {
debug("Feed is newer than the cache, update the entries");
this.cache.updated = dayjs().unix();
const feedEntry = json.feed.entry;
console.log("FEED FEED FEEED")
console.log(json.feed)
let feedEntryLength;
if (feedEntry && feedEntry.length) {
feedEntryLength = feedEntry.length;
Expand Down Expand Up @@ -170,7 +168,7 @@ export class MRSSFeed {
if (cachedAsset) {
cachedAsset.title = feedEntry.title;
cachedAsset.url = feedEntry.link;
cachedAsset.duration = -1;
cachedAsset.duration ? feedEntry.duration : -1;
cachedAsset.start_time = feedEntry.startTime
cachedAsset.end_time = feedEntry.endTime
} else {
Expand All @@ -179,7 +177,7 @@ export class MRSSFeed {
id: feedEntry.id,
title: feedEntry.title,
url: feedEntry.link,
duration: -1,
duration: feedEntry.duration ? feedEntry.duration : -1,
start_time : feedEntry.startTime,
end_time : feedEntry.endTime,
});
Expand Down

0 comments on commit 7522bd0

Please sign in to comment.