Merge branch 'dev/1.1.x' into dev/1.2.x

This commit is contained in:
vexorian 2020-10-30 01:14:15 -04:00
commit 759ac4f2ff
5 changed files with 43 additions and 14 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Container version="2">
<Name>dizquetv</Name>
<Repository>vexorian/dizquetv:latest</Repository>
<Repository>vexorian/dizquetv:latest-nvidia</Repository>
<Registry>https://hub.docker.com/r/vexorian/dizquetv</Registry>
<Network>host</Network>
<MyIP/>

View File

@ -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];

View File

@ -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'

View File

@ -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
module.exports = TVGuideService

View File

@ -62,9 +62,7 @@
</div>
</div>
<!--div class="modal-body container list-group list-group-root" vs-repeat="options" dnd-list="content" ng-if="showList()"-->
<div class="modal-body container list-group list-group-root filler-list" dnd-list="content" ng-if="showList()" >
<div class="modal-body container list-group list-group-root filler-list" vs-repeat="options" dnd-list="content" ng-if="showList()">
<div class="list-group-item flex-container filler-row" style="cursor: default;" ng-repeat="x in content" dnd-draggable="x" dnd-moved="content.splice($index, 1)" dnd-effect-allowed="move">
<div class="program-start" >
{{durationString(x.duration)}}