From 47d9b235b6f7d301f1014eb1e17e970d4be638db Mon Sep 17 00:00:00 2001 From: vexorian Date: Sat, 5 Sep 2020 18:31:00 -0400 Subject: [PATCH] Fix some last minute bugs with new setups --- index.js | 3 ++- src/ffmpeg.js | 1 - src/tv-guide-service.js | 30 ++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 751ebd0..65542e8 100644 --- a/index.js +++ b/index.js @@ -67,9 +67,10 @@ let xmltvInterval = { interval: null, lastRefresh: null, updateXML: async () => { + let channels = []; try { let channelNumbers = await channelDB.getAllChannelNumbers(); - await Promise.all( channelNumbers.map( async (x) => { + channels = await Promise.all( channelNumbers.map( async (x) => { return await channelCache.getChannelConfig(channelDB, x); }) ); await guideService.refresh( await channelDB.getAllChannels(), 12*60*60*1000 ); diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 2b20e51..a218943 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -475,7 +475,6 @@ function parseResolutionString(s) { function gcd(a, b) { while (b != 0) { - console.log(a,b); let c = b; b = a % b; a = c; diff --git a/src/tv-guide-service.js b/src/tv-guide-service.js index 6a56be7..d7673bc 100644 --- a/src/tv-guide-service.js +++ b/src/tv-guide-service.js @@ -272,21 +272,25 @@ class TVGuideService this.accumulateTable = accumulateTable; let result = {}; if (channels.length == 0) { + let channel = { + name: "dizqueTV", + icon: FALLBACK_ICON, + } result[1] = { - channel : { - name: "dizqueTV", - icon: FALLBACK_ICON, - }, + channel : channel, programs: [ - makeEntry( { + makeEntry( + channel + , { start: t0 - t0 % (30 * 60*1000), program: { + duration: 24*60*60*1000, icon: FALLBACK_ICON, - title: "No channels configured", - date: (new Date()).format('YYYY-MM-DD'), + showTitle: "No channels configured", + date: formatDateYYYYMMDD(new Date()), summary : "Use the dizqueTV web UI to configure channels." } - } ) + } ) ] } } else { @@ -427,6 +431,9 @@ function makeEntry(channel, x) { } } } + if (typeof(title)==='undefined') { + title="."; + } //what data is needed here? return { start: (new Date(x.start)).toISOString(), @@ -440,4 +447,11 @@ function makeEntry(channel, x) { } } +function formatDateYYYYMMDD(date) { + var year = date.getFullYear().toString(); + var month = (date.getMonth() + 101).toString().substring(1); + var day = (date.getDate() + 100).toString().substring(1); + return year + "-" + month + "-" + day; +} + module.exports = TVGuideService \ No newline at end of file