Fix some last minute bugs with new setups
This commit is contained in:
parent
62a58a5a46
commit
47d9b235b6
3
index.js
3
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 );
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user