Merge branch 'dev/1.0.x' into dev/1.1.x
This commit is contained in:
commit
9dd82c7d30
@ -167,6 +167,7 @@ class TVGuideService
|
||||
let x = await this.getChannelPlaying(channel, undefined, t0);
|
||||
if (x.program.duration == 0) throw Error("A " + channel.name + " " + JSON.stringify(x) );
|
||||
|
||||
let melded = 0;
|
||||
|
||||
let push = async (x) => {
|
||||
await this._throttle();
|
||||
@ -181,18 +182,26 @@ class TVGuideService
|
||||
//meld with previous
|
||||
let y = clone( programs[ programs.length - 1] );
|
||||
y.program.duration += x.program.duration;
|
||||
programs[ programs.length - 1] = y;
|
||||
} else if (isProgramFlex(x.program) ) {
|
||||
if (programs.length > 0) {
|
||||
let y = programs[ programs.length - 1];
|
||||
let a = y.start;
|
||||
let b = a + y.program.duration;
|
||||
let a2 = x.start;
|
||||
if (b > a2) {
|
||||
throw Error( [ "darn0", b, a2, JSON.stringify(y) , JSON.stringify(x) ] );
|
||||
}
|
||||
melded += x.program.duration;
|
||||
if (
|
||||
(melded > constants.TVGUIDE_MAXIMUM_PADDING_LENGTH_MS)
|
||||
&& !isProgramFlex(programs[ programs.length - 1].program)
|
||||
) {
|
||||
y.program.duration -= melded;
|
||||
programs[ programs.length - 1] = y;
|
||||
programs.push( {
|
||||
start: y.start + y.program.duration,
|
||||
program: {
|
||||
isOffline : true,
|
||||
duration: melded,
|
||||
},
|
||||
} );
|
||||
melded = 0;
|
||||
} else {
|
||||
programs[ programs.length - 1] = y;
|
||||
}
|
||||
|
||||
} else if (isProgramFlex(x.program) ) {
|
||||
melded = 0;
|
||||
programs.push( {
|
||||
start: x.start,
|
||||
program: {
|
||||
@ -201,15 +210,7 @@ class TVGuideService
|
||||
},
|
||||
} );
|
||||
} else {
|
||||
if (programs.length > 0) {
|
||||
let y = programs[ programs.length - 1];
|
||||
let a = y.start;
|
||||
let b = a + y.program.duration;
|
||||
let a2 = x.start;
|
||||
if (b > a2) {
|
||||
throw Error( [ "darn", b, a2, JSON.stringify(y) , JSON.stringify(x) ] );
|
||||
}
|
||||
}
|
||||
melded = 0;
|
||||
programs.push(x);
|
||||
}
|
||||
};
|
||||
@ -249,18 +250,7 @@ class TVGuideService
|
||||
result.programs.push( makeEntry(channel,x) );
|
||||
}
|
||||
} else {
|
||||
if (i > 0) {
|
||||
let y = programs[ i - 1];
|
||||
let x = programs[i];
|
||||
let a = y.start;
|
||||
let b = a + y.program.duration;
|
||||
let a2 = x.start;
|
||||
if (b > a2) {
|
||||
console.error( "darn2", b, a2 );
|
||||
}
|
||||
|
||||
}
|
||||
result.programs.push( makeEntry(channel, programs[i] ) );
|
||||
result.programs.push( makeEntry(channel, programs[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -158,8 +158,8 @@ function video( channelDB , db) {
|
||||
if (isLoading) {
|
||||
lineupItem = {
|
||||
type: 'loading',
|
||||
streamDuration: 1000,
|
||||
duration: 1000,
|
||||
streamDuration: 40,
|
||||
duration: 40,
|
||||
start: 0,
|
||||
};
|
||||
} else if (lineupItem == null) {
|
||||
|
||||
@ -11,6 +11,7 @@ module.exports = function ($scope, $timeout, dizquetv) {
|
||||
$scope.enableBack = false;
|
||||
$scope.showNow = false;
|
||||
$scope.nowPosition = 0;
|
||||
$scope.refreshHandle = null;
|
||||
|
||||
const intl = new Intl.DateTimeFormat('default',
|
||||
{
|
||||
@ -146,8 +147,26 @@ module.exports = function ($scope, $timeout, dizquetv) {
|
||||
$scope.enableBack = false;
|
||||
$scope.enableNext = false;
|
||||
await Promise.all($scope.channelNumbers.map( $scope.loadChannel) );
|
||||
setupTimer();
|
||||
};
|
||||
|
||||
let cancelTimerIfExists = () => {
|
||||
if ($scope.refreshHandle != null) {
|
||||
$timeout.cancel($scope.refreshHandle);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('$locationChangeStart', () => {
|
||||
console.log("$locationChangeStart" );
|
||||
cancelTimerIfExists();
|
||||
} );
|
||||
|
||||
|
||||
let setupTimer = () => {
|
||||
cancelTimerIfExists();
|
||||
$scope.refreshHandle = $timeout( () => $scope.checkUpdates(), 60000 );
|
||||
}
|
||||
|
||||
$scope.adjustZoom = async() => {
|
||||
switch ($scope.zoomLevel) {
|
||||
case 1:
|
||||
@ -310,8 +329,6 @@ module.exports = function ($scope, $timeout, dizquetv) {
|
||||
}
|
||||
$scope.channels[number] = ch;
|
||||
$scope.applyLater();
|
||||
$timeout( () => $scope.checkUpdates(), 60000 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -327,12 +344,13 @@ module.exports = function ($scope, $timeout, dizquetv) {
|
||||
|
||||
$scope.checkUpdates = async () => {
|
||||
try {
|
||||
console.log("get status " + new Date() );
|
||||
let status = await dizquetv.getGuideStatus();
|
||||
let t = new Date(status.lastUpdate).getTime();
|
||||
if ( t > $scope.lastUpdate) {
|
||||
$scope.refreshManaged();
|
||||
} else {
|
||||
$timeout( () => $scope.checkUpdates(), 60000 );
|
||||
setupTimer();
|
||||
}
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
|
||||
@ -33,6 +33,9 @@ module.exports = function ($timeout) {
|
||||
scope.onDone(JSON.parse(angular.toJson(prog)))
|
||||
scope.program = null
|
||||
}
|
||||
scope.showList = () => {
|
||||
return ! scope.showPlexLibrary && ! scope.showFallbackPlexLibrary;
|
||||
}
|
||||
scope.sortFillers = () => {
|
||||
scope.program.filler.sort( (a,b) => { return a.duration - b.duration } );
|
||||
}
|
||||
@ -60,6 +63,7 @@ module.exports = function ($timeout) {
|
||||
selectedPrograms[i].commercials = []
|
||||
}
|
||||
scope.program.filler = scope.program.filler.concat(selectedPrograms);
|
||||
scope.showPlexLibrary = false;
|
||||
}
|
||||
|
||||
scope.importFallback = (selectedPrograms) => {
|
||||
@ -70,6 +74,7 @@ module.exports = function ($timeout) {
|
||||
if (selectedPrograms.length > 0) {
|
||||
scope.program.fallback = [ selectedPrograms[0] ];
|
||||
}
|
||||
scope.showFallbackPlexLibrary = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
<div ng-show="program.filler.length === 0">
|
||||
<p class="text-center text-info">Click the <span class="fa fa-plus"></span> to import filler content from your Plex server(s).</p>
|
||||
</div>
|
||||
<div class="list-group list-group-root" dnd-list="program.filler">
|
||||
<div class="list-group list-group-root" dnd-list="program.filler" ng-if="showList()">
|
||||
<div class="list-group-item flex-container" style="cursor: default;" ng-repeat="x in program.filler" dnd-draggable="x" dnd-moved="program.filler.splice($index, 1)" dnd-effect-allowed="move">
|
||||
<div class="program-start" >
|
||||
{{durationString(x.duration)}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user