From 0571b10d6efe4d95d27df6959bbab2c033f3e56e Mon Sep 17 00:00:00 2001 From: Efox Date: Sun, 30 Jul 2023 21:59:03 -0300 Subject: [PATCH] v17.0.9 - Options to edit channels/categories on "Live" section had disappeared in the last versions but now they are back - Minor improvements and bugfixes --- config.xml | 2 +- package.json | 2 +- www/nodejs-project/assets/js/app/utils.js | 1 - www/nodejs-project/assets/js/index/index.js | 2 +- .../modules/channels/channels.js | 6 ++-- www/nodejs-project/modules/cloud/cloud.js | 4 +-- .../modules/download/download-p2p-client.js | 2 +- .../modules/explorer/explorer.js | 2 +- .../modules/lists/epg-worker.js | 2 +- .../modules/lists/list-index-utils.js | 4 +-- .../modules/lists/list-index.js | 2 +- www/nodejs-project/modules/lists/loader.js | 35 +++++++++++++------ www/nodejs-project/modules/lists/manager.js | 33 +++++++++++++---- .../modules/lists/update-list-index.js | 5 +-- .../modules/lists/updater-worker.js | 4 ++- .../modules/multi-worker/multi-worker.js | 29 ++++++++------- .../modules/multi-worker/utils.js | 19 +++++----- .../modules/multi-worker/worker.js | 2 +- .../modules/promoter/promoter.js | 16 +++++++-- .../modules/streamer/engines/yt.js | 2 +- .../modules/streamer/utils/proxy-hls.js | 2 +- .../modules/streamer/utils/stream-info.js | 4 +-- .../modules/tuner/auto-tuner.js | 2 +- www/nodejs-project/modules/tuner/tuner.js | 2 +- www/nodejs-project/package.json | 2 +- 25 files changed, 119 insertions(+), 67 deletions(-) diff --git a/config.xml b/config.xml index 2c0a6143..4ebecd4b 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + Megacubo An intuitive, free and open source IPTV player. diff --git a/package.json b/package.json index 68ab3285..141b6e7e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tv.megacubo.app", "displayName": "Megacubo", - "version": "17.0.8", + "version": "17.0.9", "description": "A intuitive and multi-language IPTV player.", "main": "index.js", "scripts": { diff --git a/www/nodejs-project/assets/js/app/utils.js b/www/nodejs-project/assets/js/app/utils.js index e7ecad43..91bde573 100644 --- a/www/nodejs-project/assets/js/app/utils.js +++ b/www/nodejs-project/assets/js/app/utils.js @@ -115,7 +115,6 @@ function loadJS(url, cb, retries=3){ setTimeout(function (){ loadJS(url, cb, retries) }, 1) - } else { console.warn('ERROR', url); setTimeout(cb, 1) diff --git a/www/nodejs-project/assets/js/index/index.js b/www/nodejs-project/assets/js/index/index.js index 234bee4c..5ed23382 100644 --- a/www/nodejs-project/assets/js/index/index.js +++ b/www/nodejs-project/assets/js/index/index.js @@ -321,7 +321,7 @@ function updateSplashProgress(increase) { function fakeUpdateProgress() { let timer = setInterval(function () { fakeTasksCount--; - if (!fakeTasksCount) { + if (fakeTasksCount <= 0) { clearInterval(timer); } updateSplashProgress(); diff --git a/www/nodejs-project/modules/channels/channels.js b/www/nodejs-project/modules/channels/channels.js index 87bfd711..4190ebfa 100644 --- a/www/nodejs-project/modules/channels/channels.js +++ b/www/nodejs-project/modules/channels/channels.js @@ -1281,7 +1281,7 @@ class Channels extends ChannelsKids { moreOptions.push(this.shareChannelEntry(e)) moreOptions.push(streamsEntry) } - if(global.config.get('channel-grid') == '' && global.config.get('allow-edit-channel-list') && (e.path || global.explorer.path).indexOf(global.lang.SEARCH) == -1){ // avoid it on search results to prevent bugs + if(!global.config.get('channel-grid') && global.config.get('allow-edit-channel-list') && (e.path || global.explorer.path).indexOf(global.lang.SEARCH) == -1){ // avoid it on search results to prevent bugs const editEntry = this.editChannelEntry(e, category, {name: category ? global.lang.EDIT_CHANNEL : global.lang.EDIT, details: undefined, class: 'no-icon', fa: 'fas fa-edit', users: undefined, usersPercentage: undefined, path: undefined, url: undefined}) moreOptions.push(editEntry) } @@ -1400,7 +1400,7 @@ class Channels extends ChannelsKids { } let list const type = global.config.get('channel-grid') - const editable = type == '' && global.config.get('allow-edit-channel-list') + const editable = !type && global.config.get('allow-edit-channel-list') if(type == 'lists') { list = await this.groupsRenderer('live') } else { @@ -1562,7 +1562,7 @@ class Channels extends ChannelsKids { options(){ return new Promise((resolve, reject) => { let entries = [] - if(global.config.get('channel-grid') == '' && global.config.get('allow-edit-channel-list')){ + if(!global.config.get('channel-grid') && global.config.get('allow-edit-channel-list')){ entries.push(this.editCategoriesEntry()) } entries.push(...[ diff --git a/www/nodejs-project/modules/cloud/cloud.js b/www/nodejs-project/modules/cloud/cloud.js index 43dcb006..c922f0bf 100644 --- a/www/nodejs-project/modules/cloud/cloud.js +++ b/www/nodejs-project/modules/cloud/cloud.js @@ -10,7 +10,7 @@ class CloudConfiguration { 'searching': 6 * 3600, 'channels': 6 * 3600, 'configure': 3600, - 'promo': 300, + 'promos': 300, 'country-sources': 6 * 3600, 'watching-country': 300 } @@ -29,7 +29,7 @@ class CloudConfiguration { throw 'Bad config server URL' } url(key){ - if(['configure', 'promo', 'themes'].includes(key)){ + if(['configure', 'promos', 'themes'].includes(key)){ return this.server + '/' + key + '.json' } else if(key.indexOf('/') != -1 || key.indexOf('.') != -1) { return this.server + '/stats/data/' + key + '.json' diff --git a/www/nodejs-project/modules/download/download-p2p-client.js b/www/nodejs-project/modules/download/download-p2p-client.js index c49b0328..6a59365b 100644 --- a/www/nodejs-project/modules/download/download-p2p-client.js +++ b/www/nodejs-project/modules/download/download-p2p-client.js @@ -205,7 +205,7 @@ class P2PPeer extends P2PEncDec { let left = this.sockets.length const done = () => { left-- - if (left == 0) { + if (left <= 0) { this.writing = false this.drain() } diff --git a/www/nodejs-project/modules/explorer/explorer.js b/www/nodejs-project/modules/explorer/explorer.js index c771f49f..143fd2db 100644 --- a/www/nodejs-project/modules/explorer/explorer.js +++ b/www/nodejs-project/modules/explorer/explorer.js @@ -242,7 +242,7 @@ class Explorer extends Events { if(typeof(level) != 'number'){ level = 1 } - while(p && level){ + while(p && level >= 0){ p = this.dirname(p) level-- } diff --git a/www/nodejs-project/modules/lists/epg-worker.js b/www/nodejs-project/modules/lists/epg-worker.js index b5c1616a..50c96c88 100644 --- a/www/nodejs-project/modules/lists/epg-worker.js +++ b/www/nodejs-project/modules/lists/epg-worker.js @@ -1,5 +1,5 @@ const ListsCommon = require('../lists/common'), xmltv = require('xmltv') -const Events = require('events'), utils = require('../multi-worker/utils') +const Events = require('events'), utils = require('../multi-worker/utils')(__filename) class EPGPaginateChannelsList extends Events { constructor(){ diff --git a/www/nodejs-project/modules/lists/list-index-utils.js b/www/nodejs-project/modules/lists/list-index-utils.js index eb0885cc..17334494 100644 --- a/www/nodejs-project/modules/lists/list-index-utils.js +++ b/www/nodejs-project/modules/lists/list-index-utils.js @@ -89,7 +89,7 @@ class ListIndexUtils extends Events { reject('list destroyed') } else { if(!line || line.charAt(0) != '{'){ - console.error('Bad line readen', line, this.file, i) + console.error('Bad line readen', this.file, i) } if(!map || map.includes(i)){ lines[i] = line @@ -158,7 +158,7 @@ class ListIndexUtils extends Events { index = parsed // old style compat } } catch(e) { - console.error('Index parsing failure', line, e, this.file) + console.error('Index parsing failure', e, this.file) } } if(index && typeof(index.length) != 'undefined'){ diff --git a/www/nodejs-project/modules/lists/list-index.js b/www/nodejs-project/modules/lists/list-index.js index eabe571e..26dfb0cd 100644 --- a/www/nodejs-project/modules/lists/list-index.js +++ b/www/nodejs-project/modules/lists/list-index.js @@ -22,7 +22,7 @@ class ListIndex extends ListIndexUtils { entries = global.parseJSON('['+ Object.values(lines).join(',') +']') // remove undefineds too } catch(e) {} if(!Array.isArray(entries)){ - console.error('Failed to get lines', lines, map, entries, this.file) + console.error('Failed to get lines', this.file) throw 'failed to get lines' } if(entries.length) { diff --git a/www/nodejs-project/modules/lists/loader.js b/www/nodejs-project/modules/lists/loader.js index cd718166..4f87bfe1 100644 --- a/www/nodejs-project/modules/lists/loader.js +++ b/www/nodejs-project/modules/lists/loader.js @@ -53,13 +53,6 @@ class ListsLoader extends Events { this.resetLowPriorityUpdates() } async resetLowPriorityUpdates(){ // load community lists - const maxListsToTry = 192 - const minListsToTry = Math.max(64, 3 * this.communityListsAmount) - if(minListsToTry < this.master.processedLists.size) return - - const taskId = Math.random() - this.currentTaskId = taskId - this.master.updaterFinished(false) this.processes = this.processes.filter(p => { /* Cancel pending processes to reorder it */ if(p.priority > 1 && !p.started() && !p.done()) { @@ -69,6 +62,16 @@ class ListsLoader extends Events { return true }) + if(!this.communityListsAmount) return + + const maxListsToTry = 192 + const minListsToTry = Math.max(64, 3 * this.communityListsAmount) + if(minListsToTry < this.master.processedLists.size) return + + const taskId = Math.random() + this.currentTaskId = taskId + this.master.updaterFinished(false) + const lists = await global.discovery.get(maxListsToTry) const communityLists = [] lists.some(({ url }) => { @@ -94,7 +97,9 @@ class ListsLoader extends Events { this.once('destroy', () => updater.terminate()) this.updaterClients = 1 updater.close = () => { - this.updaterClients-- + if(this.updaterClients > 0){ + this.updaterClients-- + } if(!this.updaterClients && !this.updater.terminating){ this.updater.terminating = setTimeout(() => { console.error('Terminating updater worker') @@ -187,10 +192,20 @@ class ListsLoader extends Events { } async reload(url){ let updateErr + const progressId = 'reloading-'+ parseInt(Math.random() * 1000000) + const progressListener = p => { + if(p.progressId == progressId) { + global.osd.show(global.lang.RECEIVING_LIST +' '+ p.progress +'%', 'fas fa-circle-notch fa-spin', 'progress-'+ progressId, 'persistent') + } + } + progressListener({progressId, progress: 0}) await this.prepareUpdater() - this.results[url] = 'reloading' - this.results[url] = await this.updater.updateList(url, true).catch(err => updateErr = err) + this.updater.on('progress', progressListener) + this.results[url] = 'reloading' + this.results[url] = await this.updater.updateList(url, true, progressId).catch(err => updateErr = err) this.updater && this.updater.close() + this.updater.removeListener('progress', progressListener) + global.osd.hide('progress-'+ progressId) if(updateErr) throw updateErr await this.master.loadList(url).catch(err => updateErr = err) if(updateErr) throw updateErr diff --git a/www/nodejs-project/modules/lists/manager.js b/www/nodejs-project/modules/lists/manager.js index 35c9617b..8a11cbae 100644 --- a/www/nodejs-project/modules/lists/manager.js +++ b/www/nodejs-project/modules/lists/manager.js @@ -791,7 +791,7 @@ class Manager extends ManagerEPG { throw err } else { global.osd.show(global.lang.LIST_ADDED, 'fas fa-check-circle', 'add-list', 'normal') - const protect = !fromCommunity && value.match(new RegExp('(pwd?|pass|password)=', 'i')) // protect sensible lists + const protect = !fromCommunity && (value.match(new RegExp('(pwd?|pass|password)=', 'i')) || value.match(new RegExp('/[0-9]{5,}/[0-9]{5,}'))) // protect sensible lists const currentEPG = global.config.get('epg-'+ global.lang.locale) const community = global.config.get('communitary-mode-lists-amount') > 0 const chosen = (!protect && community && global.validateURL(value)) ? await global.explorer.dialog([ @@ -810,7 +810,7 @@ class Manager extends ManagerEPG { this.setMeta(value, 'private', chosen != 'yes') let info, i = 20 if(currentEPG != 'disabled'){ - while(i && (!info || !info[value])){ + while(i > 0 && (!info || !info[value])){ i-- await this.wait(500) info = await this.master.info() @@ -1285,7 +1285,19 @@ class Manager extends ManagerEPG { type: 'group', class: 'skip-testing', renderer: async () => { - let es = [] + let es = [] + let contactUrl, contactFa + const meta = this.master.lists[url] ? this.master.lists[url].index.meta : {} + if(meta.site) { + contactUrl = meta.site + contactFa = 'fas fa-globe' + } else if(meta.email) { + contactUrl = 'mailto:'+ meta.email + contactFa = 'fas fa-envelope' + } else if(meta.phone) { + contactUrl = 'tel:+'+ meta.phone.replace(new RegExp('[^0-9]+'), '') + contactFa = 'fas fa-phone' + } const options = [ { name: global.lang.RENAME, @@ -1329,7 +1341,17 @@ class Manager extends ManagerEPG { class: 'skip-testing', action: this.removeList.bind(this) } - ] + ] + if(contactUrl) { + options.splice(2, 0, { + name: global.lang.CONTACT_PROVIDER, + type: 'action', + fa: contactFa, + action: () => { + global.ui.emit('open-external-url', contactUrl) + } + }) + } if(manageOnly) return options es = await this.directListRenderer({url}, { raw: true, @@ -1343,7 +1365,7 @@ class Manager extends ManagerEPG { } es.unshift({ name: global.lang.OPTIONS, - fa: 'fas fa-edit', + fa: 'fas fa-bars', type: 'select', entries: options }) @@ -1375,7 +1397,6 @@ class Manager extends ManagerEPG { } async refreshList(data){ let updateErr - global.osd.show(global.lang.UPDATING_LISTS, 'fa-mega spin-x-alt', 'refresh-list', 'persistent') await this.master.loader.reload(data.url).catch(e => updateErr = e) if(updateErr){ if(updateErr == 'empty list'){ diff --git a/www/nodejs-project/modules/lists/update-list-index.js b/www/nodejs-project/modules/lists/update-list-index.js index 31e8fa29..71b9bc69 100644 --- a/www/nodejs-project/modules/lists/update-list-index.js +++ b/www/nodejs-project/modules/lists/update-list-index.js @@ -71,6 +71,7 @@ class UpdateListIndex extends ListIndexUtils { console.error('ADDLISThttp='+path) let resolved const opts = { + debug: false, url: path, p2p: !!this.forceDownload, retries: 3, @@ -231,7 +232,7 @@ class UpdateListIndex extends ListIndexUtils { this.indexateIterator++ }) this.parser.on('progress', readen => { - const cl = this.contentLength || 40 * (1024 * 1024) // estimate it if we don't know + const cl = this.contentLength > 0 ? this.contentLength : 62 * (1024 * 1024) // estimate it if we don't know const pp = cl / 100 let progress = parseInt(readen / pp) if(progress > 99) progress = 99 @@ -251,7 +252,7 @@ class UpdateListIndex extends ListIndexUtils { } } - if(progress > this.lastProgress) { + if(progress != this.lastProgress) { this.lastProgress = progress this.emit('progress', progress) } diff --git a/www/nodejs-project/modules/lists/updater-worker.js b/www/nodejs-project/modules/lists/updater-worker.js index 84b42a17..2b688ba4 100644 --- a/www/nodejs-project/modules/lists/updater-worker.js +++ b/www/nodejs-project/modules/lists/updater-worker.js @@ -1,6 +1,7 @@ const Common = require('./common'), List = require('./list') -const UpdateListIndex = require('./update-list-index'), utils = require('../multi-worker/utils') +const UpdateListIndex = require('./update-list-index') +const utils = require('../multi-worker/utils')(__filename) class ListsUpdater extends Common { constructor(){ @@ -44,6 +45,7 @@ class ListsUpdater extends Common { if(this.debug){ console.log('updater updateList', url) } + progressId && utils.emit('progress', {progressId, progress: 0}) const should = force === true || (await this.updaterShouldUpdate(url)) const now = global.time() if(this.debug){ diff --git a/www/nodejs-project/modules/multi-worker/multi-worker.js b/www/nodejs-project/modules/multi-worker/multi-worker.js index 549b9be6..57a22802 100644 --- a/www/nodejs-project/modules/multi-worker/multi-worker.js +++ b/www/nodejs-project/modules/multi-worker/multi-worker.js @@ -29,7 +29,11 @@ const setupConstructor = () => { this.terminating = {} } proxy(file){ - const trace = '' // global.traceback() + file = path.resolve(file) + if(this.instances[file]) { + return this.instances[file] + } + this.worker.postMessage({method: 'loadWorker', file}) const instance = new Proxy(this, { get: (self, method) => { const trace = global.traceback() @@ -43,7 +47,6 @@ const setupConstructor = () => { } return (...args) => { return new Promise((resolve, reject) => { - const debug = false if(self.finished){ if(self.terminating[file]) { return resolve() @@ -61,21 +64,17 @@ const setupConstructor = () => { delete self.instances[file] delete self.terminating[file] } - debug && global.osd.show(path.basename(file) +' '+ method +' OK', 'fas fas-circle-notch', 'mwrk-'+ id, 'normal') }, reject: err => { - debug && global.osd.show(path.basename(file) +' '+ method +' '+ String(err), 'fas fas-circle-notch faclr-red', 'mwrk-'+ id, 'long') reject(err) }, file, method } - debug && global.osd.show(path.basename(file) +' '+ method, 'fas fas-circle-notch', 'mwrk-'+ id, 'long') try { self.worker.postMessage({method, id, file, args}) } catch(e) { console.error({e, method, id, file, args, trace}) - debug && global.osd.show(path.basename(file) +' '+ method +' '+ String(err), 'fas fas-circle-notch faclr-red', 'mwrk-'+ id, 'long') } }) } @@ -99,7 +98,6 @@ const setupConstructor = () => { } load(file){ if(this.worker){ - this.worker.postMessage({method: 'loadWorker', file}) return this.proxy(file) } else { throw 'Worker already terminated: '+ file @@ -161,24 +159,29 @@ const setupConstructor = () => { this.rejectAll(null, this.err || 'worker exited') }) this.worker.on('message', ret => { - if(ret.id !== 0){ + if(ret.id){ if(ret.id && typeof(this.promises[ret.id]) != 'undefined'){ this.promises[ret.id][ret.type](ret.data) delete this.promises[ret.id] } else { console.warn('Callback repeated: '+ JSON.stringify(ret)) } - } else if(ret.type && ret.type == 'event') { - let pos = ret.data.indexOf(':') + } else { + let args = [], pos = ret.data.indexOf(':') if(pos != -1){ let evtType = ret.data.substr(0, pos) let evtContent = ret.data.substr(pos + 1) if(evtContent.length){ evtContent = global.parseJSON(evtContent) } - this.emit(evtType, evtContent) + args = [evtType, evtContent] + } else { + args = [ret.data] + } + if(ret.file) { + this.instances[ret.file] && this.instances[ret.file].emit(...args) } else { - this.emit(ret.data) + this.emit(...args) } } }) @@ -232,7 +235,7 @@ const setupConstructor = () => { } } return ThreadWorkerDriver - // return DirectDriver // useful for debugging + //return DirectDriver // useful for debugging } module.exports = setupConstructor() diff --git a/www/nodejs-project/modules/multi-worker/utils.js b/www/nodejs-project/modules/multi-worker/utils.js index 4cf85fc2..9b96dc40 100644 --- a/www/nodejs-project/modules/multi-worker/utils.js +++ b/www/nodejs-project/modules/multi-worker/utils.js @@ -6,16 +6,17 @@ if(parentPort) { postMessage = () => {} } -const emit = (type, content) => { - postMessage({id: 0, type: 'event', data: type +':'+ JSON.stringify(content)}) -} - -function logErr(data) { - postMessage({id: 0, type: 'event', data: 'error:'+ JSON.stringify(data), file: global.file}) -} - function loadGlobalVars() { Object.keys(workerData || {}).forEach(k => global[k] = workerData[k]) } -module.exports = {logErr, postMessage, parentPort, emit, loadGlobalVars} \ No newline at end of file +module.exports = file => { + file = file.replace(new RegExp('\.jsc?$'), '') + const emit = (type, content) => { + postMessage({id: 0, file, type: 'event', data: type +':'+ JSON.stringify(content)}) + } + const logErr = (data) => { + postMessage({id: 0, file, type: 'event', data: 'error:'+ JSON.stringify(data), file: global.file}) + } + return {logErr, postMessage, parentPort, emit, loadGlobalVars} +} \ No newline at end of file diff --git a/www/nodejs-project/modules/multi-worker/worker.js b/www/nodejs-project/modules/multi-worker/worker.js index 0c861465..922e4e73 100644 --- a/www/nodejs-project/modules/multi-worker/worker.js +++ b/www/nodejs-project/modules/multi-worker/worker.js @@ -1,5 +1,5 @@ const Cloud = require('../cloud') -const { logErr, parentPort, loadGlobalVars } = require('./utils') +const { logErr, parentPort, loadGlobalVars } = require('./utils')(__filename) loadGlobalVars() require('../supercharge')(global) diff --git a/www/nodejs-project/modules/promoter/promoter.js b/www/nodejs-project/modules/promoter/promoter.js index 657a60ed..370834ed 100644 --- a/www/nodejs-project/modules/promoter/promoter.js +++ b/www/nodejs-project/modules/promoter/promoter.js @@ -35,15 +35,21 @@ class Promoter { const atts = { communitary: global.config.get('communitary-mode-lists-amount') > 0, premium: global.options.prm(true), - country: global.lang.countryCode + country: global.lang.countryCode, + platform: process.platform, + version: global.MANIFEST.version } - const c = await global.cloud.get('promo') + const c = await global.cloud.get('promos') if(!Array.isArray(c)) return const promos = c.filter(p => { if(p.type != type) return return Object.keys(atts).every(k => { if(k == 'country') { return typeof(p.countries) == 'undefined' || p.countries.includes(atts[k]) + } else if(k == 'platform') { + return typeof(p.platforms) == 'undefined' || p.platforms.includes(atts[k]) + } else if(k == 'version') { + return typeof(p.minVersion) == 'undefined' || atts.version >= p.minVersion } else { return typeof(p[k]) == 'undefined' || p[k] == atts[k] } @@ -65,9 +71,13 @@ class Promoter { callbacks[id] = async () => { if(!o.url) return if(o.url.indexOf('{email}') != -1) { - const email = await global.explorer.prompt(o.prompt || o.name, o.placeholder || '', '', false, o.fa, null) + const email = await global.explorer.prompt(o.emailPrompt || '', o.emailPlaceholder || '', '', false, o.fa, null) o.url = o.url.replace('{email}', encodeURIComponent(email || '')) } + if(o.url.indexOf('{name}') != -1) { + const email = await global.explorer.prompt(o.namePrompt || '', o.namePlaceholder || '', '', false, o.fa, null) + o.url = o.url.replace('{name}', encodeURIComponent(email || '')) + } if(o.confirmation) { global.Download.get({ url: o.url, diff --git a/www/nodejs-project/modules/streamer/engines/yt.js b/www/nodejs-project/modules/streamer/engines/yt.js index 59712b5a..a6b9c799 100644 --- a/www/nodejs-project/modules/streamer/engines/yt.js +++ b/www/nodejs-project/modules/streamer/engines/yt.js @@ -35,7 +35,7 @@ class StreamerYTHLSIntent extends StreamerHLSIntent { } async getYTInfo(id){ let info, err, retries = 5, url = 'https://www.youtube.com/watch?v='+ id - while((!info || !info.formats) && retries){ + while((!info || !info.formats) && retries) { retries-- console.warn('TRY', global.time()) info = await ytdl.getInfo(url, { diff --git a/www/nodejs-project/modules/streamer/utils/proxy-hls.js b/www/nodejs-project/modules/streamer/utils/proxy-hls.js index 801c1c7c..bb2795a0 100644 --- a/www/nodejs-project/modules/streamer/utils/proxy-hls.js +++ b/www/nodejs-project/modules/streamer/utils/proxy-hls.js @@ -315,7 +315,7 @@ class HLSRequests extends StreamerProxyBase { if(status == 410){ status = 404 } - if(status == 403 && this.prefetchMaxConcurrency){ // concurrent connection limit? + if(status == 403 && this.prefetchMaxConcurrency > 0){ // concurrent connection limit? this.prefetchMaxConcurrency-- } if(status == 404){ diff --git a/www/nodejs-project/modules/streamer/utils/stream-info.js b/www/nodejs-project/modules/streamer/utils/stream-info.js index 91e22961..c8d600e9 100644 --- a/www/nodejs-project/modules/streamer/utils/stream-info.js +++ b/www/nodejs-project/modules/streamer/utils/stream-info.js @@ -55,7 +55,7 @@ class StreamInfo { let trackUrl = strSample.split("\n").map(s => s.trim()).filter(line => line.length > 3 && line.charAt(0) != '#').shift() trackUrl = global.absolutize(trackUrl, url) recursion-- - if(!recursion){ + if(recursion <= 0){ return reject('Max recursion reached.') } return this._probe(trackUrl, timeoutSecs, retries, opts, recursion).then( resolve ).catch(err => { @@ -66,7 +66,7 @@ class StreamInfo { let trackUrl = strSample.split("\n").map(s => s.trim()).filter(line => line.length > 3 && line.charAt(0) != '#').shift() trackUrl = global.absolutize(trackUrl, url) recursion-- - if(!recursion){ + if(recursion <= 0){ return reject('Max recursion reached.') } return this._probe(trackUrl, timeoutSecs, retries, opts, recursion).then(ret =>{ diff --git a/www/nodejs-project/modules/tuner/auto-tuner.js b/www/nodejs-project/modules/tuner/auto-tuner.js index ce382196..418c95f5 100644 --- a/www/nodejs-project/modules/tuner/auto-tuner.js +++ b/www/nodejs-project/modules/tuner/auto-tuner.js @@ -276,7 +276,7 @@ class AutoTuner extends Events { index.length = 0 } } else { - if(slotCount){ + if(slotCount > 0){ this.tuner.paused && this.tuner.resume() } else { !this.tuner.paused && this.tuner.pause() diff --git a/www/nodejs-project/modules/tuner/tuner.js b/www/nodejs-project/modules/tuner/tuner.js index ebfae8f5..2b3041ed 100644 --- a/www/nodejs-project/modules/tuner/tuner.js +++ b/www/nodejs-project/modules/tuner/tuner.js @@ -15,7 +15,7 @@ class TunerUtils extends Events { this.setMaxListeners(64) this.paused = true this.opts = { - debug: true, + debug: false, shadow: false, allowedTypes: null } diff --git a/www/nodejs-project/package.json b/www/nodejs-project/package.json index 30ccdc05..c9c557e1 100644 --- a/www/nodejs-project/package.json +++ b/www/nodejs-project/package.json @@ -46,7 +46,7 @@ "description": "A intuitive, multi-language and cross-platform IPTV player.", "name": "megacubo", "icon": "./default_icon.png", - "version": "17.0.8", + "version": "17.0.9", "theme": { "fullScreen": true },