Merge pull request #378 from vexorian/20210921_dev

20210921 dev
This commit is contained in:
vexorian 2021-09-21 08:43:24 -04:00 committed by GitHub
commit cbf907788c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# dizqueTV 1.4.5-development
# dizqueTV 1.4.6-development
![Discord](https://img.shields.io/discord/711313431457693727?logo=discord&logoColor=fff&style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/vexorian/dizquetv?logo=github&style=flat-square) ![Docker Pulls](https://img.shields.io/docker/pulls/vexorian/dizquetv?logo=docker&logoColor=fff&style=flat-square)
Create live TV channel streams from media on your Plex servers.

View File

@ -3,7 +3,7 @@ module.exports = {
TVGUIDE_MAXIMUM_PADDING_LENGTH_MS: 30*60*1000,
DEFAULT_GUIDE_STEALTH_DURATION: 5 * 60* 1000,
TVGUIDE_MAXIMUM_FLEX_DURATION : 6 * 60 * 60 * 1000,
TOO_FREQUENT: 100,
TOO_FREQUENT: 1000,
VERSION_NAME: "1.4.5-development"
VERSION_NAME: "1.4.6-development"
}

View File

@ -15,29 +15,38 @@ function equalItems(a, b) {
function wereThereTooManyAttempts(sessionId, lineupItem) {
let obj = cache[sessionId];
let t1 = (new Date()).getTime();
if (typeof(obj) === 'undefined') {
let previous = cache[sessionId];
if (typeof(previous) === 'undefined') {
previous = cache[sessionId] = {
t0: t1 - constants.TOO_FREQUENT * 5
t0: t1 - constants.TOO_FREQUENT * 5,
lineupItem: null,
};
} else {
clearTimeout(obj.timer);
}
previous.timer = setTimeout( () => {
cache[sessionId].timer = null;
delete cache[sessionId];
}, constants.TOO_FREQUENT*5 );
let result = false;
if (previous.t0 + constants.TOO_FREQUENT >= t1) {
if (t1 - previous.t0 < constants.TOO_FREQUENT) {
//certainly too frequent
result = equalItems( previous.lineupItem, lineupItem );
}
cache[sessionId].t0 = t1;
cache[sessionId].lineupItem = lineupItem;
cache[sessionId] = {
t0: t1,
lineupItem : lineupItem,
};
setTimeout( () => {
if (
(typeof(cache[sessionId]) !== 'undefined')
&&
(cache[sessionId].t0 === t1)
) {
delete cache[sessionId];
}
}, constants.TOO_FREQUENT * 5 );
return result;
}

View File

@ -300,6 +300,7 @@ function video( channelDB , fillerDB, db) {
channelCache.recordPlayback(channel.number, t0, lineupItem);
}
if (wereThereTooManyAttempts(session, lineupItem)) {
console.error("There are too many attempts to play the same item in a short period of time, playing the error stream instead.");
lineupItem = {
isOffline: true,
err: Error("Too many attempts, throttling.."),

View File

@ -51,7 +51,7 @@ function writePromise(json, xmlSettings, throttle, cacheImageService) {
function _writeDocStart(xw) {
xw.startDocument()
xw.startElement('tv')
xw.writeAttribute('generator-info-name', 'psuedotv-plex')
xw.writeAttribute('generator-info-name', 'dizquetv')
}
function _writeDocEnd(xw, ws) {
xw.endElement()