Skip to content

Commit 5b9ec67

Browse files
committed
v17.4.2
- Improved EPG management. - Ensured that the search field is displayed when adding MAG lists. - Minor bugfixes and improvements.
1 parent c6a4f03 commit 5b9ec67

File tree

23 files changed

+114
-92
lines changed

23 files changed

+114
-92
lines changed

config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget android-versionCode="454" id="tv.megacubo.app" version="17.4.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2+
<widget android-versionCode="456" id="tv.megacubo.app" version="17.4.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
33
<name>Megacubo</name>
44
<description>
55
An intuitive, free and open source IPTV player.
@@ -65,7 +65,7 @@
6565
<preference name="AndroidXEnabled" value="true" />
6666
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/android/icon/drawable-xxxhdpi-icon.png" />
6767
<preference name="AndroidWindowSplashScreenBackground" value="#362064" />
68-
<preference name="OverrideUserAgent" value="Megacubo 17.4.1" />
68+
<preference name="OverrideUserAgent" value="Megacubo 17.4.2" />
6969
<icon src="resources/android/icon/drawable-ldpi-icon.png" />
7070
<icon background="@color/background" density="ldpi" foreground="resources/android/icon/ldpi-foreground.png" qualifier="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
7171
<icon background="@color/background" density="mdpi" foreground="resources/android/icon/mdpi-foreground.png" qualifier="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "megacubo",
33
"displayName": "Megacubo",
4-
"version": "17.4.1",
4+
"version": "17.4.2",
55
"description": "A intuitive and multi-language IPTV player.",
66
"repository": {
77
"type": "git",

www/nodejs-project/main.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ const init = (language, timezone) => {
274274
global.lists.setNetworkConnectionState(global.Download.isNetworkConnected).catch(console.error)
275275

276276
new OMNI()
277-
277+
278278
global.mega = new Mega()
279279
global.energy = new Energy()
280280
global.streamer = new Streamer()
@@ -299,8 +299,8 @@ const init = (language, timezone) => {
299299

300300
promo = new Promoter()
301301

302-
streamState = new StreamState()
303-
streamState.on('state', (url, state, source) => {
302+
global.streamState = new StreamState()
303+
global.streamState.on('state', (url, state, source) => {
304304
source && global.discovery.reportHealth(source, state != 'offline')
305305
})
306306

@@ -440,7 +440,7 @@ const init = (language, timezone) => {
440440
})
441441
global.ui.on('testing-stop', () => {
442442
console.warn('TESTING STOP')
443-
streamState.cancelTests()
443+
global.streamState.cancelTests()
444444
})
445445
global.ui.on('tuning-stop', () => {
446446
console.warn('TUNING ABORT')
@@ -617,7 +617,7 @@ const init = (language, timezone) => {
617617
global.ui.once('init', () => {
618618
global.explorer.start()
619619
global.icons.refresh()
620-
streamState.sync()
620+
global.streamState.sync()
621621
if(!global.uiReady()){
622622
global.uiReady(null, true)
623623
}
@@ -651,12 +651,8 @@ const init = (language, timezone) => {
651651
if(global.streamer.active && !global.config.get('miniplayer-auto')){
652652
global.streamer.stop()
653653
}
654-
if(global.tuning){
655-
global.tuning.destroy()
656-
}
657-
if(streamState){
658-
streamState.cancelTests()
659-
}
654+
global.tuning && global.tuning.destroy()
655+
global.streamState && global.streamState.cancelTests()
660656
})
661657

662658
global.uiReady(async () => {

www/nodejs-project/modules/channels/channels.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ class Channels extends ChannelsKids {
11731173
throw global.lang.NONE_STREAM_FOUND
11741174
}
11751175
} else {
1176-
if(streams.length){
1176+
if(streams.length) {
11771177
let call = global.lists.mi.isRadio(e.name +' '+ category) ? global.lang.LISTEN_NOW : global.lang.WATCH_NOW
11781178
entries.push({
11791179
name: call,
@@ -1192,17 +1192,18 @@ class Channels extends ChannelsKids {
11921192
type: 'group',
11931193
renderer: async () => streams
11941194
}
1195-
if(this.loadedEPG){
1195+
if(this.loadedEPG) {
11961196
epgEntry = {
11971197
name: global.lang.EPG,
1198-
type: 'group',
1198+
type: 'group',
11991199
fa: this.epgIcon,
12001200
details: (epgNow && epgNow != category) ? epgNow : '',
12011201
renderer: this.epgChannelEntries.bind(this, e)
12021202
}
12031203
}
1204-
} else {
1205-
entries.push(Object.assign(this.emptyEntry, {name: global.lang.NONE_STREAM_FOUND}))
1204+
} else {
1205+
const name = global.lists.loaded(true) ? global.lang.NONE_STREAM_FOUND : global.lang.NO_LISTS_ADDED
1206+
entries.push(Object.assign(this.emptyEntry, { name }))
12061207
if(global.lists.activeLists.my.length) {
12071208
global.lists.manager.checkListExpiral(
12081209
global.lists.activeLists.my.map(source => ({source}))
@@ -1355,35 +1356,31 @@ class Channels extends ChannelsKids {
13551356
global.explorer.refreshNow()
13561357
}
13571358
async entries(){
1358-
if(!global.lists.loaded()){
1359+
if(!global.lists.loaded()) {
13591360
return [global.lists.manager.updatingListsEntry()]
13601361
}
1361-
if(!global.lists.loaded(true)){ // one list available on index beyound meta watching list
1362-
return [global.lists.manager.noListsEntry()]
1363-
}
13641362
let list
1365-
const type = global.config.get('channel-grid')
1363+
const publicMode = global.config.get('public-lists') && !global.lists.loaded(true) // no list available on index beyound public lists
1364+
const type = publicMode ? 'public' : global.config.get('channel-grid')
13661365
const editable = !type && global.config.get('allow-edit-channel-list')
1367-
if(type == 'lists') {
1366+
if(type == 'public') {
1367+
list = await global.discovery.providers.find(p => p[1] == 'public')[0].entries()
1368+
} else if(type == 'lists') {
13681369
list = await this.groupsRenderer('live')
13691370
} else {
13701371
const categories = this.channelList.getCategories()
13711372
list = categories.map(category => {
13721373
category.renderer = async (c, e) => {
13731374
let times = {}, startTime = global.time()
13741375
let channels = category.entries.map(e => this.isChannel(e.name)).filter(e => !!e)
1375-
const ret = await global.lists.has(channels, {
1376-
partial: false
1377-
})
1376+
const ret = await global.lists.has(channels, {partial: false})
13781377
times['has'] = global.time() - startTime
13791378
let entries = category.entries.filter(e => ret[e.name])
13801379
entries = entries.map(e => this.toMetaEntry(e, category))
13811380
times['meta'] = global.time() - startTime - times['has']
13821381
entries = await this.epgChannelsAddLiveNow(entries, true)
13831382
entries = this.sortCategoryEntries(entries)
1384-
if(editable){
1385-
entries.push(this.editCategoryEntry(c))
1386-
}
1383+
editable && entries.push(this.editCategoryEntry(c))
13871384
times['epg'] = global.time() - startTime - times['has'] - times['meta']
13881385
return entries
13891386
}
@@ -1392,10 +1389,9 @@ class Channels extends ChannelsKids {
13921389
list = global.lists.sort(list)
13931390
list.push(this.allCategoriesEntry())
13941391
}
1395-
if(editable){
1396-
list.push(this.getCategoryEntry())
1397-
}
1392+
editable && list.push(this.getCategoryEntry())
13981393
list.unshift(this.chooseChannelGridOption())
1394+
publicMode && list.unshift(global.lists.manager.noListsEntry())
13991395
return list
14001396
}
14011397
allCategoriesEntry() {
@@ -1626,11 +1622,11 @@ class Channels extends ChannelsKids {
16261622
if(!global.lists.loaded()){
16271623
return [global.lists.manager.updatingListsEntry()]
16281624
}
1629-
if(!global.lists.loaded(true)){
1630-
return [global.lists.manager.noListsEntry()]
1631-
}
16321625
const isSeries = type == 'series'
16331626
let groups = await global.lists.groups(type ? [type] : ['series', 'vod'])
1627+
if(!groups.length && !global.lists.loaded(true)){
1628+
return [global.lists.manager.noListsEntry()]
1629+
}
16341630
const acpolicy = global.config.get('parental-control')
16351631
const groupToEntry = group => {
16361632
const name = group.name

www/nodejs-project/modules/download/download-cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class DownloadCacheMap extends Events {
183183
chunks.fail(chunks.error)
184184
delete this.saving[url]
185185
} else if((this.saving[url].size === false && !expectedLength) || (expectedLength > chunks.size)) {
186-
const err = 'Bad file size. Expected: '+ this.saving[url].size +', received: '+ chunks.size +', discarding http cache.'
186+
const err = 'Bad file size. Expected: '+ this.saving[url].size +', expected*: '+ expectedLength +', received: '+ chunks.size +', discarding http cache.'
187187
console.warn(err)
188188
chunks.fail(err)
189189
delete this.saving[url]

www/nodejs-project/modules/download/download.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ class Download extends Events {
979979
this.statusCode = statusCode
980980
this.headers = {}
981981
this.buffer = [] // discard any
982-
console.warn('Download error: '+ err, this.redirectLog, this.opts.url, this.currentURL, this.redirectCount, this, global.traceback())
982+
console.warn('Download error: '+ err, this.redirectLog, this.opts.url, this.currentURL, this.redirectCount, global.traceback())
983983
this.errors.push(String(err) || 'unknown request error')
984984
if(!this.currentRequestError){
985985
this.currentRequestError = 'error'

www/nodejs-project/modules/explorer/client.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ class Explorer extends ExplorerLoading {
20432043
trange.start -= tolerance
20442044
}
20452045
this.currentEntries.forEach((e, i) => {
2046-
let lazy = i < trange.start || i > trange.end
2046+
const lazy = i < trange.start || i > trange.end
20472047
entries[i] = Object.assign({lazy}, e)
20482048
if(lazy && !this.ranging) {
20492049
this.ranging = true
@@ -2058,10 +2058,10 @@ class Explorer extends ExplorerLoading {
20582058
if(this.ranging){
20592059
const changed = [], shouldUpdateRange = config['show-logos'] && this.currentEntries.length > (this.viewSizeX * this.viewSizeY)
20602060
if(shouldUpdateRange){
2061-
let rgx = new RegExp('<img', 'i'), elements = this.currentElements, entries = this.getRange(y || this._wrapper.scrollTop)
2061+
let rgx = new RegExp('<img', 'i'), elements = this.currentElements, entries = this.getRange(y)
20622062
//console.log('selectionMemory upadeteRange', entries)
20632063
if(this.debug){
2064-
console.warn("UPDATING RANGE", entries, traceback())
2064+
console.warn("UPDATING RANGE", y, this._scrollContainer.scrollTop, entries, traceback())
20652065
}
20662066
entries.forEach(e => {
20672067
if(!elements[e.tabindex]) return
@@ -2074,7 +2074,7 @@ class Explorer extends ExplorerLoading {
20742074
}
20752075
}
20762076
if(this.debug){
2077-
console.warn(e.type, type, elements[e.tabindex], e.tabindex, this.selectedIndex)
2077+
//console.warn(e.type, type, elements[e.tabindex], e.tabindex, this.selectedIndex)
20782078
}
20792079
if(update){
20802080
if(e.lazy){
@@ -2085,7 +2085,7 @@ class Explorer extends ExplorerLoading {
20852085
tpl = this.templates[e.type]
20862086
}
20872087
let n = this.j(this.renderEntry(e, tpl, this.path)).get(0)
2088-
elements[e.tabindex].parentNode.replaceChild(n, elements[e.tabindex])
2088+
this._wrapper.replaceChild(n, elements[e.tabindex])
20892089
changed.push(n)
20902090
}
20912091
})
@@ -2097,7 +2097,7 @@ class Explorer extends ExplorerLoading {
20972097
}
20982098
this.currentElements = Array.from(this._wrapper.getElementsByTagName('a'))
20992099
this.emit('update-range', changed)
2100-
if(this.selectedIndex < this.range.start || this.selectedIndex >= this.range.end){
2100+
if(this.selectedIndex < this.range.start || this.selectedIndex > this.range.end){
21012101
this.focus(this.currentElements[this.range.start], true)
21022102
} else {
21032103
this.focus(this.currentElements[this.selectedIndex], true)

www/nodejs-project/modules/icon-server/icon-server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ class IconServerStore extends IconSearch {
232232
} else {
233233
const gsign = content.toString('ascii', 0, 3)
234234
if(gsign === 'GIF') {
235-
return 0 // no GIF please, too problematic
235+
if(content.length > (512 * 1024)) { // 512kb
236+
return 0 // avoid huge GIFs
237+
} else {
238+
return 1
239+
}
236240
}
237241
}
238242
const magic = content.toString('hex', 0, 4)

www/nodejs-project/modules/icon-server/icon.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ class IconFetcher extends Events {
9393
const ret = await this.master.fetchURL(this.entry.programme.i).catch(e => err = e)
9494
if(!err) return [ret.key, true, ret.isAlpha]
9595
}
96-
let err
97-
const ret = await this.master.fetchURL(this.entry.icon).catch(e => err = e)
98-
if(!err) return [ret.key, true, ret.isAlpha]
96+
if(this.entry.icon) {
97+
let err
98+
const ret = await this.master.fetchURL(this.entry.icon).catch(e => err = e)
99+
if(!err) return [ret.key, true, ret.isAlpha]
100+
}
99101
if(!this.entry.class || this.entry.class.indexOf('entry-icon-no-fallback') == -1) {
100102
let atts
101103
this.terms = global.channels.entryTerms(this.entry)

www/nodejs-project/modules/lists/lists.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ class Lists extends ListsEPGTools {
384384
const ret = {
385385
url,
386386
progress,
387+
firstRun,
387388
satisfyAmount,
388389
communityListsAmount,
389390
isUpdatingFinished: this.isUpdaterFinished,
390391
pendingCount: this.queue._pendingCount,
391-
firstRun,
392392
length: Object.values(this.lists).filter(l => l.isReady).length
393393
}
394394
if(progress > 99) {
@@ -459,21 +459,24 @@ class Lists extends ListsEPGTools {
459459
}
460460
}
461461
}
462-
let err, isMine = this.myLists.includes(url)
462+
let err, defaultOrigin, isMine = this.myLists.includes(url)
463463
if(this.debug){
464464
console.log('loadList start', url)
465465
}
466466
if(!this.loadTimes[url]){
467467
this.loadTimes[url] = {}
468468
} else {
469+
if(this.lists[url]) {
470+
defaultOrigin = this.lists[url].origin
471+
}
469472
this.remove(url)
470473
}
471474
this.loadTimes[url].adding = global.time()
472475
this.requesting[url] = 'loading'
473476
const list = new List(url, this)
474477
list.skipValidating = true // list is already validated at lists/updater-worker, always
475478
list.contentLength = contentLength
476-
list.origin = global.discovery.details(url, 'type') || ''
479+
list.origin = isMine ? 'own' : (global.discovery.details(url, 'type') || defaultOrigin || '')
477480
list.once('destroy', () => {
478481
if(!this.requesting[url] || (this.requesting[url] == 'loading')) {
479482
this.requesting[url] = 'destroyed'

www/nodejs-project/modules/lists/manager.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ class Manager extends ManagerEPG {
806806
if(offerCommunityMode){
807807
extraOpts.push({template: 'option', text: global.lang.COMMUNITY_LISTS, fa: 'fas fa-users', id: 'sh'})
808808
}
809-
extraOpts.push({template: 'option', text: global.lang.ADD_MAC_ADDRESS, fa: 'fas fa-hard-drive', id: 'mac'})
809+
extraOpts.push({template: 'option', text: global.lang.ADD_MAC_ADDRESS, fa: 'fas fa-hdd', id: 'mac'})
810810
let id = await global.explorer.prompt({
811811
question: global.lang.ASK_IPTV_LIST,
812812
placeholder: 'http://',
@@ -949,7 +949,7 @@ class Manager extends ManagerEPG {
949949
const macAddress = this.formatMacAddress(await global.explorer.prompt({
950950
question: global.lang.MAC_ADDRESS,
951951
placeholder: '00:00:00:00:00:00',
952-
fa: 'fas fa-hard-drive'
952+
fa: 'fas fa-hdd'
953953
}))
954954
if(!macAddress || macAddress.length != 17) throw 'Invalid MAC address'
955955
let server = await global.explorer.prompt({
@@ -961,7 +961,11 @@ class Manager extends ManagerEPG {
961961
if(server.charAt(server.length - 1) == '/') {
962962
server = server.substr(0, server.length - 1)
963963
}
964-
const url = await this.getM3UPlaylistForMac(macAddress, server)
964+
let err
965+
global.osd.show(global.lang.PROCESSING, 'fas fa-circle-notch fa-spin', 'add-list-mac', 'persistent')
966+
const url = await this.getM3UPlaylistForMac(macAddress, server).catch(e => err = e)
967+
global.osd.hide('add-list-mac')
968+
if(err) throw err
965969
return await this.addList(url)
966970
}
967971
formatMacAddress(str) {

www/nodejs-project/modules/omni/client.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ class OMNI extends OMNIUtils {
3838
jQuery(document).on('keyup', this.eventHandler.bind(this))
3939
}
4040
bind(){
41-
app.on('omni-enable', () => {
42-
this.element.css('display', 'inline-flex')
43-
})
41+
app.on('omni-enable', () => this.element.css('display', 'inline-flex'))
42+
app.on('omni-disable', () => this.element.css('display', 'none'))
4443
app.on('omni-callback', (text, success) => {
4544
if(success){
4645
this.save()

www/nodejs-project/modules/omni/omni.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ const Events = require('events')
33
class OMNI extends Events {
44
constructor (){
55
super()
6-
this.bind()
7-
}
8-
bind(){
96
global.ui.on('omni-client-ready', () => {
10-
if(this.omniEnabled){
7+
if(this.enabled){
118
global.ui.emit('omni-enable') // on linux, ui was loading after lists update, this way the search field was not showing up
129
}
1310
})
@@ -37,10 +34,13 @@ class OMNI extends Events {
3734
global.ui.emit('omni-callback', text, true)
3835
})
3936
})
40-
global.lists.manager.waitListsReady().then(() => {
41-
this.omniEnabled = true
42-
global.ui.emit('omni-enable')
43-
}).catch(console.error)
37+
global.lists.on('status', status => {
38+
const enabled = global.lists.satisfied && status.length
39+
if(enabled != this.enabled) {
40+
this.enabled = enabled
41+
global.ui.emit(enabled ? 'omni-enable' : 'omni-disable')
42+
}
43+
})
4444
}
4545
}
4646

www/nodejs-project/modules/osd/osd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class OSDSrv {
33
constructor(){
44
}
55
show(text, icon, name, time){
6-
console.log('osd-show', text, global.traceback())
6+
console.log('osd-show', text)
77
global.ui.emit('osd-show', text, icon, name, time)
88
}
99
hide(name){

0 commit comments

Comments
 (0)