diff --git a/dizquetv-nvidia.xml b/dizquetv-nvidia.xml index f55aeac..119d37c 100644 --- a/dizquetv-nvidia.xml +++ b/dizquetv-nvidia.xml @@ -1,7 +1,7 @@ dizquetv - vexorian/dizquetv:latest + vexorian/dizquetv:latest-nvidia https://hub.docker.com/r/vexorian/dizquetv host diff --git a/src/plex-player.js b/src/plex-player.js index 69c69aa..9bde669 100644 --- a/src/plex-player.js +++ b/src/plex-player.js @@ -52,6 +52,9 @@ class PlexPlayer { throw Error(`Unable to find server "${lineupItem.serverKey}" specied by program.`); } server = server[0]; + if (server.uri.endsWith("/")) { + server.uri = server.uri.slice(0, server.uri.length - 1); + } try { let plexSettings = db['plex-settings'].find()[0]; diff --git a/src/plex.js b/src/plex.js index 97e4461..41a8e16 100644 --- a/src/plex.js +++ b/src/plex.js @@ -2,8 +2,15 @@ const request = require('request') class Plex { constructor(opts) { this._accessToken = typeof opts.accessToken !== 'undefined' ? opts.accessToken : '' + let uri = "http://127.0.0.1:32400"; + if ( (typeof opts.uri) !== 'undefined' ) { + uri = opts.uri; + if (uri.endsWith("/")) { + uri = uri.slice(0, uri.length - 1); + } + } this._server = { - uri: typeof opts.uri !== 'undefined' ? opts.uri : 'http://127.0.0.1:32400', + uri: uri, host: typeof opts.host !== 'undefined' ? opts.host : '127.0.0.1', port: typeof opts.port !== 'undefined' ? opts.port : '32400', protocol: typeof opts.protocol !== 'undefined' ? opts.protocol : 'http' diff --git a/src/tv-guide-service.js b/src/tv-guide-service.js index e56225b..9227827 100644 --- a/src/tv-guide-service.js +++ b/src/tv-guide-service.js @@ -113,6 +113,7 @@ class TVGuideService let playing = {}; if ( (typeof(previousKnown) !== 'undefined') + && (previousKnown.index !== -1) && (previousKnown.program.duration == channel.programs[previousKnown.index].duration ) && (previousKnown.start + previousKnown.program.duration == t) ) { @@ -126,6 +127,17 @@ class TVGuideService } else { playing = await this.getCurrentPlayingIndex(channel, t); } + if ( (playing.program == null) || (typeof(playing) === 'undefined') ) { + console.log("There is a weird issue with the TV guide generation. A placeholder program is placed to prevent further issues. Please report this."); + playing = { + index: -1, + program: { + isOffline: true, + duration: 30*60*1000, + }, + start: t + } + } if ( playing.program.isOffline && playing.program.type === 'redirect') { let ch2 = playing.program.channel; @@ -189,13 +201,15 @@ class TVGuideService ) { y.program.duration -= melded; programs[ programs.length - 1] = y; - programs.push( { - start: y.start + y.program.duration, - program: { - isOffline : true, - duration: melded, - }, - } ); + if (y.start + y.program.duration < t1) { + programs.push( { + start: y.start + y.program.duration, + program: { + isOffline : true, + duration: melded, + }, + } ); + } melded = 0; } else { programs[ programs.length - 1] = y; @@ -216,7 +230,14 @@ class TVGuideService }; while (x.start < t1) { await push(x); - x = await this.getChannelPlaying(channel, x, x.start + x.program.duration); + let t2 = x.start + x.program.duration; + x = await this.getChannelPlaying(channel, x, t2); + if (x.start < t2) { + let d = t2 - x.start; + x.start = t2; + x.program = clone(x.program); + x.program.duration -= d; + } if (x.program.duration == 0) { console.error("There's a program with duration 0?"); } @@ -470,4 +491,4 @@ function formatDateYYYYMMDD(date) { return year + "-" + month + "-" + day; } -module.exports = TVGuideService \ No newline at end of file +module.exports = TVGuideService diff --git a/web/public/templates/filler-config.html b/web/public/templates/filler-config.html index 5e4ee1f..f82bb4e 100644 --- a/web/public/templates/filler-config.html +++ b/web/public/templates/filler-config.html @@ -62,9 +62,7 @@ - - -