diff --git a/src/constants.js b/src/constants.js index 0e5dc5f..0b3c66a 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,7 +1,7 @@ module.exports = { SLACK: 9999, TVGUIDE_MAXIMUM_PADDING_LENGTH_MS: 30*60*1000, - STEALTH_DURATION: 5 * 60* 1000, + DEFAULT_GUIDE_STEALTH_DURATION: 5 * 60* 1000, TVGUIDE_MAXIMUM_FLEX_DURATION : 6 * 60 * 60 * 1000, TOO_FREQUENT: 100, diff --git a/src/tv-guide-service.js b/src/tv-guide-service.js index 8d69b41..87424b0 100644 --- a/src/tv-guide-service.js +++ b/src/tv-guide-service.js @@ -173,10 +173,10 @@ class TVGuideService await this._throttle(); if ( (programs.length > 0) - && isProgramFlex(x.program) + && isProgramFlex(x.program, channel) && ( (x.program.duration <= constants.TVGUIDE_MAXIMUM_PADDING_LENGTH_MS) - || isProgramFlex(programs[ programs.length - 1].program) + || isProgramFlex(programs[ programs.length - 1].program, channel) ) ) { //meld with previous @@ -185,7 +185,7 @@ class TVGuideService melded += x.program.duration; if ( (melded > constants.TVGUIDE_MAXIMUM_PADDING_LENGTH_MS) - && !isProgramFlex(programs[ programs.length - 1].program) + && !isProgramFlex(programs[ programs.length - 1].program, channel) ) { y.program.duration -= melded; programs[ programs.length - 1] = y; @@ -200,7 +200,7 @@ class TVGuideService } else { programs[ programs.length - 1] = y; } - } else if (isProgramFlex(x.program) ) { + } else if (isProgramFlex(x.program, channel) ) { melded = 0; programs.push( { start: x.start, @@ -222,7 +222,7 @@ class TVGuideService result.programs = []; for (let i = 0; i < programs.length; i++) { await this._throttle(); - if (isProgramFlex( programs[i].program) ) { + if (isProgramFlex( programs[i].program, channel) ) { let start = programs[i].start; let duration = programs[i].program.duration; if (start <= t0) { @@ -391,10 +391,21 @@ function _wait(t) { } +function getChannelStealthDuration(channel) { + if ( + (typeof(channel.guideMinimumDurationSeconds) !== 'undefined') + && + ! isNaN(channel.guideMinimumDurationSeconds) + ) { + return channel.guideMinimumDurationSeconds * 1000; + } else { + return constants.DEFAULT_GUIDE_STEALTH_DURATION; + } + +} - -function isProgramFlex(program) { - return program.isOffline || program.duration <= constants.STEALTH_DURATION +function isProgramFlex(program, channel) { + return program.isOffline || program.duration <= getChannelStealthDuration(channel) } function clone(o) { @@ -413,8 +424,13 @@ function makeEntry(channel, x) { let title = undefined; let icon = undefined; let sub = undefined; - if (isProgramFlex(x.program)) { - title = channel.name; + if (isProgramFlex(x.program, channel)) { + if ( (typeof(channel.guideFlexPlaceholder) === 'string') + && channel.guideFlexPlaceholder !== "") { + title = channel.guideFlexPlaceholder; + } else { + title = channel.name; + } icon = channel.icon; } else { title = x.program.showTitle; diff --git a/web/directives/channel-config.js b/web/directives/channel-config.js index 1fda00f..e3cbfb1 100644 --- a/web/directives/channel-config.js +++ b/web/directives/channel-config.js @@ -29,8 +29,10 @@ module.exports = function ($timeout, $location, dizquetv) { scope.channel = {} scope.channel.programs = [] scope.channel.fillerCollections = [] + scope.channel.guideFlexPlaceholder = ""; scope.channel.fillerRepeatCooldown = 30 * 60 * 1000; scope.channel.fallback = []; + scope.channel.guideMinimumDurationSeconds = 5 * 60; scope.isNewChannel = true scope.channel.icon = `${$location.protocol()}://${location.host}/images/dizquetv.png` scope.channel.disableFillerOverlay = true; @@ -95,6 +97,12 @@ module.exports = function ($timeout, $location, dizquetv) { if (typeof(scope.channel.disableFillerOverlay) === 'undefined') { scope.channel.disableFillerOverlay = true; } + if ( + (typeof(scope.channel.guideMinimumDurationSeconds) === 'undefined') + || isNaN(scope.channel.guideMinimumDurationSeconds) + ) { + scope.channel.guideMinimumDurationSeconds = 5 * 60; + } scope.channel.startTime = new Date(t - offset); // move runningProgram to index 0 scope.channel.programs = scope.channel.programs.slice(runningProgram, this.length) @@ -121,6 +129,15 @@ module.exports = function ($timeout, $location, dizquetv) { } } + scope.tabOptions = [ + { name: "Properties", id: "basic" }, + { name: "Programming", id: "programming" }, + { name: "Flex", id: "flex" }, + { name: "EPG", id: "epg" }, + ]; + scope.setTab = (tab) => { + scope.tab = tab; + } if (scope.isNewChannel) { scope.tab = "basic"; diff --git a/web/public/templates/channel-config.html b/web/public/templates/channel-config.html index c9b3f92..6d82d36 100644 --- a/web/public/templates/channel-config.html +++ b/web/public/templates/channel-config.html @@ -3,34 +3,14 @@