Skip to content

Commit

Permalink
v17.1.5
Browse files Browse the repository at this point in the history
- Fixes in the portrait mode layout
- Minor improvements and bugfixes
- More versatility for defining list meta-info by supporting X-M3U-Meta-(Name|Icon|Site|EPG|Auth-URL) http headers, in addition to the pltv-* inline tags that are already supported.
  • Loading branch information
EdenwareApps committed Aug 17, 2023
1 parent dbea10e commit 64b31e9
Show file tree
Hide file tree
Showing 25 changed files with 112 additions and 77 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="382" id="tv.megacubo.app" version="17.1.4" 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">
<widget android-versionCode="385" id="tv.megacubo.app" version="17.1.5" 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">
<name>Megacubo</name>
<description>
An intuitive, free and open source IPTV player.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tv.megacubo.app",
"displayName": "Megacubo",
"version": "17.1.4",
"version": "17.1.5",
"description": "A intuitive and multi-language IPTV player.",
"main": "index.js",
"scripts": {
Expand Down
64 changes: 32 additions & 32 deletions www/nodejs-project/assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ body.video #explorer header .explorer-omni {
background: linear-gradient(to bottom, rgba(0,0,0, 0.3), rgba(255, 255, 255, 0.05));
border-radius: var(--padding-2x);
display: none;
min-width: calc(var(--explorer-entry-width) * 1.3);
min-width: calc(var(--explorer-entry-name-font-size) * 14);
text-align: left;
align-items: center;
margin-right: calc(var( --padding) * 2);
Expand All @@ -216,44 +216,43 @@ body.home #explorer content a.entry-2x {
width: calc(200% / var(--entries-per-row));
max-width: 100%;
}
body.explorer-vertical #explorer content a.entry-2x {
height: calc(200% / var(--entries-per-col));
}
body.explorer-vertical span.entry-icon-image {
height: 100% !important;
justify-content: left !important;
bottom: 0 !important;
margin-left: 1%;
}
body.explorer-vertical span.entry-icon-image img {
background-position: center left !important;
max-width: calc(var(--explorer-entry-height) * 0.94);
}
body.explorer-vertical #explorer content a span.entry-data-in {
--explorer-entry-details-font-size: calc(var(--explorer-entry-name-font-size) * 0.8);
height: -webkit-fill-available;
display: flex;
align-items: start;
justify-content: center;
flex-direction: column;
padding-left: calc(6% + var(--explorer-entry-height));
box-sizing: border-box;
padding-bottom: 0;
top: 0;
}
body.explorer-vertical #explorer content a .entry-name, body.explorer-vertical #explorer content a .entry-details {
text-align: left !important;
}
@media (orientation: portrait) {
#explorer header .explorer-omni > span:not(.selected) input {
display: none;
}
#explorer header .explorer-omni > span {
min-width: 0;
}
body.explorer-vertical #explorer content a.entry-2x {
height: calc(200% / var(--entries-per-col));
}
body.explorer-vertical span.entry-icon-image {
height: 100% !important;
justify-content: left !important;
bottom: 0 !important;
margin-left: 1%;
}
body.explorer-vertical span.entry-icon-image img {
background-position: center left !important;
max-width: calc(var(--explorer-entry-height) * 0.94);
}
body.explorer-vertical #explorer content a span.entry-data-in {
--explorer-entry-name-font-size: calc(((100vmin + 100vmax) * 0.45) * 0.032) !important;
--explorer-entry-details-font-size: calc(var(--explorer-entry-name-font-size) * 0.8);
height: -webkit-fill-available;
display: flex;
align-items: start;
justify-content: center;
flex-direction: column;
padding-left: calc(var(--explorer-entry-height) * 1.25);
box-sizing: border-box;
padding-bottom: 0;
top: 0;
}
body.explorer-vertical #explorer content a .entry-name, body.explorer-vertical #explorer content a .entry-details {
text-align: left !important;
}
}
@media (orientation: landscape) {
body:not(.explorer-vertical) {
#explorer content a.entry-2x {
width: calc(200% / var(--entries-per-row));
}
Expand Down Expand Up @@ -330,6 +329,7 @@ div#home-arrows {
position: relative;
width: 100vw;
align-items: center;
z-index: 1;
}
span#home-arrows-top {
transform: translateY(calc(-2 * var(--padding)));
Expand Down Expand Up @@ -621,7 +621,7 @@ controls {
display: block;
box-sizing: border-box;
background: linear-gradient(to bottom, transparent 0%, black 100%);
bottom: calc((var(--controls-height) + var(--seekbar-height)) * -1);
bottom: calc((var(--controls-height) + var(--seekbar-height)) * -2);
}
body.video controls {
transition: bottom var(--animation-duration-normal), transform var(--explorer-fx-nav-duration) ease-in-out 0s;
Expand Down
18 changes: 5 additions & 13 deletions www/nodejs-project/assets/js/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,17 @@ function initApp(){
app.on('background-mode-unlock', name => {
if(parent.player && parent.winman) parent.winman && parent.winman.backgroundModeUnlock(name)
})
let initP2PDetails, initP2P = () => {
if(!initP2PDetails || !config || !config['p2p']) return
const done = () => {
let initP2PDetails, initializedP2P, initP2P = () => {
if(!initP2PDetails || !config || initializedP2P || !config['p2p']) return
initializedP2P = true
loadJSOnIdle('./modules/download/discovery-swarm-webrtc-bundle.js', () => {
if(typeof(require) == 'function') {
loadJSOnIdle('./modules/download/download-p2p-client.js', () => {
const {addr, limit, stunServers} = initP2PDetails
window.p2p = new P2PManager(app, addr, limit, stunServers)
})
}
}
if(typeof(require) != 'function' && typeof(parent.parent.require) == 'function') {
window.require = parent.parent.require
}
if(typeof(require) == 'function') {
done()
} else {
// browserify -r @geut/discovery-swarm-webrtc -r crypto -r safe-buffer -o assets/js/libs/webrtc-bundle.js
loadJSOnIdle('./modules/download/discovery-swarm-webrtc-bundle.js', done)
}
})
}
app.on('init-p2p', (addr, limit, stunServers) => {
initP2PDetails = {addr, limit, stunServers}
Expand Down
10 changes: 5 additions & 5 deletions www/nodejs-project/assets/js/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ function exit() {
function openExternalFile(file, mimetype) {
console.log('openExternalFile', file);
if (parent.cordova) {
alert('cannot open file ' + file.split('/').pop());
alert('Cannot open file: ' + file.split('/').pop())
} else if (parent.getElectronRemote) {
parent.getElectronRemote().shell.openExternal(file);
parent.getElectronRemote().shell.openExternal(file)
} else {
window.open(file, '_system');
window.open(file, '_system')
}
}

Expand All @@ -237,9 +237,9 @@ function openExternalURL(url) {
if (url.match(new RegExp('https://megacubo.tv', 'i'))) {
url = url.replace('https:', 'http:'); // bypass Ionic Deeplink
}
parent.navigator.app.loadUrl(url, { openExternal: true });
parent.navigator.app.loadUrl(url, { openExternal: true })
} else if (parent.getElectronRemote) {
parent.getElectronRemote().shell.openExternal(url);
parent.getElectronRemote().shell.openExternal(url)
} else {
window.open(url);
}
Expand Down
2 changes: 1 addition & 1 deletion www/nodejs-project/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ALL_LISTS": "Todas as listas",
"ALSO_SEARCH_YOUTUBE": "Pesquise também no YouTube",
"ALWAYS": "Sempre",
"ALWAYS_TRANSCODE_TO_MP4": "Sempre transcoda para mp4",
"ALWAYS_TRANSCODE_TO_MP4": "Sempre transcodificar para mp4",
"AMOUNT_OF_LISTS": "Quantidade de listas",
"AMOUNT_OF_LISTS_HINT": "Um número maior de listas aumenta a quantidade de transmissões disponíveis, mas aumenta também o uso de memória podendo deixar o aplicativo lento e pesado em um dispositivo que tenha pouca memória RAM disponível.",
"ANIMATE_BACKGROUND": "Animar fundo",
Expand Down
1 change: 1 addition & 0 deletions www/nodejs-project/modules/channels/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ class ChannelsEditing extends ChannelsEPG {
return t
}, action: (entry, val) => {
const category = _category
if(!this.categories[category]) return console.error('Category not found')
console.warn('ALIASES', this.categories[category], category, val, o)
let i = -1
this.categories[category].some((n, j) => {
Expand Down
4 changes: 2 additions & 2 deletions www/nodejs-project/modules/discovery/providers/iptv-org.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class IPTV extends Events {
}
let lists = locs.map(code => this.data[code]).filter(c => c)
if(lists.length){
const maxLists = 48
const maxLists = 48, factor = 0.9 // factor here adds some gravity to grant higher priority to community lists instead
if(lists.length > maxLists){
lists = lists.slice(0, maxLists)
}
return lists.map((list, i) => {
list = {url: list, health: 1 - (i * (1 / lists.length))}
list = {url: list, health: factor * (1 - (i * (1 / lists.length)))}
return list
})
} else {
Expand Down
2 changes: 1 addition & 1 deletion www/nodejs-project/modules/download/download-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DownloadCacheFileReader extends Events {
}
destroy(){
this.removeAllListeners()
this.stream && this.stream.close()
this.stream && this.stream.close && this.stream.close()
}
}

Expand Down
10 changes: 6 additions & 4 deletions www/nodejs-project/modules/download/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class Download extends Events {
this.connectCount = 0
this.currentRequestError = ''
this.currentResponse = null
this.authURLPingAfter = 0
this.responseSource = ''
this.on('error', () => {}) // avoid uncaught exception, make error listening not mandatory
if(typeof(this.opts.headers['range']) != 'undefined'){
Expand All @@ -108,13 +107,14 @@ class Download extends Events {
}
pingAuthURL(){
const now = global.time()
if(this.opts.authURL && now > this.authURLPingAfter){
this.authURLPingAfter = now + 10
if(this.opts.authURL && (!Download.pingAuthDelay[this.opts.authURL] || now > Download.pingAuthDelay[this.opts.authURL])){
Download.pingAuthDelay[this.opts.authURL] = now + 120
Download.get({
url: this.opts.authURL,
timeout: 10,
timeout: 20,
retry: 0,
receiveLimit: 1,
downloadLimit: 1,
followRedirect: true
}).catch(err => {
console.error('pingAuthURL error: '+ String(err))
Expand Down Expand Up @@ -737,6 +737,7 @@ class Download extends Events {
console.log('>> Download redirect', this.opts.followRedirect, response.headers['location'], this.currentURL)
}
this.redirectLog.push(this.currentURL)
this.emit('redirect', this.currentURL, response.headers)
process.nextTick(() => {
if(this.opts.followRedirect){
this.destroyStream()
Expand Down Expand Up @@ -1031,6 +1032,7 @@ const networkListeners = []
Download.stream = DownloadStreamHybrid
Download.cache = new DownloadCacheMap()
Download.keepAliveDomainBlacklist = []
Download.pingAuthDelay = {}
Download.isNetworkConnected = true
Download.setNetworkConnectionState = state => {
Download.isNetworkConnected = state
Expand Down
7 changes: 6 additions & 1 deletion www/nodejs-project/modules/explorer/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ class ExplorerPointer extends ExplorerSelectionMemory {
this.viewSizeX = this._viewSizeX
this.viewSizeY = this._viewSizeY
}
const verticalLayout = config[portrait ? 'view-size-portrait-x' : 'view-size-x'] == 1
jQuery(document.body)[verticalLayout ? 'addClass' : 'removeClass']('explorer-vertical')
let e = document.querySelector('a:not(.entry-2x) .entry-icon-image')
if(e){
let metrics = e.getBoundingClientRect()
Expand Down Expand Up @@ -1716,7 +1718,10 @@ class ExplorerStatusFlags extends ExplorerSlider {
this[status == 'offline' ? 'addClass' : 'removeClass'](element, 'entry-disabled')
if(content != element.getAttribute('data-status-flags-html')){
element.setAttribute('data-status-flags-html', content)
element.querySelector('.entry-status-flags').innerHTML = content
var flagsElement = element.querySelector('.entry-status-flags')
if(flagsElement) {
flagsElement.innerHTML = content
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion www/nodejs-project/modules/ffmpeg/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class FFmpegController {
if(this.debug){
console.log('ffmpeg.exec _abort '+ executionId)
}
parent.parent.ffmpeg.abort(executionId)
let keepIds = []
Object.keys(this.executionIds).forEach(k => {
if(this.executionIds[k] == executionId){
Expand All @@ -92,6 +91,12 @@ class FFmpegController {
keepIds.push(this.executionIds[k])
}
})
const ffmpeg = parent.parent.ffmpeg
if(ffmpeg.abort) {
ffmpeg.abort(executionId)
} else {
ffmpeg.kill(executionId)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion www/nodejs-project/modules/icon-server/icon-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class IconServerStore extends IconSearch {
fs.read(fd, Buffer.alloc(readSize), 0, readSize, 0, (err, bytesRead, content) => {
if(err) return reject(err)
let v = this.validate(content)
if(v){
if(v) {
resolve(v)
} else {
reject('file not validated')
Expand Down
6 changes: 6 additions & 0 deletions www/nodejs-project/modules/lists/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ class Lists extends ListsEPGTools {
this.manager = new Manager(this)
this.configChanged()
}
getAuthURL(listUrl) {
if(listUrl && this.lists[listUrl] && this.lists[listUrl].index && this.lists[listUrl].index.meta && this.lists[listUrl].index.meta['auth-url']) {
return this.lists[listUrl].index.meta['auth-url']
}
return listUrl
}
configChanged(){
const myLists = global.config.get('lists').map(l => l[1])
const newLists = myLists.filter(u => !this.myLists.includes(u))
Expand Down
9 changes: 9 additions & 0 deletions www/nodejs-project/modules/lists/update-list-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ class UpdateListIndex extends ListIndexUtils {
this.index.groups[entry.group].push(i)
return entry
}
parseHeadersMeta(headers) {
const prefix = 'x-m3u-meta-'
Object.keys(headers).filter(k => k.startsWith(prefix)).forEach(k => {
const name = k.substr(prefix.length)
this.index.meta[name] = headers[k]
})
}
fetch(path){
return new Promise((resolve, reject) => {
if(path.match(new RegExp('^//[^/]+\\.'))){
Expand All @@ -87,11 +94,13 @@ class UpdateListIndex extends ListIndexUtils {
}
this.stream = new global.Download(opts)
const file = global.paths.temp + '/'+ this.stream.opts.uid +'.bin'
this.stream.on('redirect', (url, headers) => this.parseHeadersMeta(headers))
this.stream.on('response', (statusCode, headers) => {
if(this.debug){
console.log('response', statusCode, headers, this.updateMeta)
}
resolved = true
this.parseHeadersMeta(headers)
if(statusCode >= 200 && statusCode < 300){
this.contentLength = this.stream.totalContentLength
if(this.stream.totalContentLength > 0 && (this.stream.totalContentLength == this.updateMeta.contentLength)){
Expand Down
4 changes: 2 additions & 2 deletions www/nodejs-project/modules/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,8 @@ class Options extends OptionsP2P {
}
prm(strict) {
const p = global.premium
if(p.active) return !strict || p.active == 'activation'
if(p.enabling) return true
if(p && p.active) return !strict || p.active == 'activation'
if(p && p.enabling) return true
const licensed = global.config.get('premium-license') && !global.config.get('premium-disable')
return !!licensed
}
Expand Down
2 changes: 1 addition & 1 deletion www/nodejs-project/modules/promoter/promoter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Promoter {
async offer(type){
const atts = {
communitary: global.config.get('communitary-mode-lists-amount') > 0,
premium: global.options.prm(true),
premium: global.options.prm(),
country: global.lang.countryCode,
platform: process.platform,
version: global.MANIFEST.version
Expand Down
5 changes: 4 additions & 1 deletion www/nodejs-project/modules/streamer/engines/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class StreamerBaseIntent extends Events {
this.audioTrack = 0
this.subtitleTrack = null
this.failListener = this.onFail.bind(this)
if(!this.data.authURL && this.data.source) {
this.data.authURL = global.lists.getAuthURL(this.data.source)
}
if(opts){
this.setOpts(opts)
}
Expand Down Expand Up @@ -63,7 +66,7 @@ class StreamerBaseIntent extends Events {
getTranscodingOpts(){
return Object.assign({
workDir: this.opts.workDir,
authURL: this.data.source,
authURL: this.data.authURL || this.data.source,
debug: this.opts.debug,
isLive: this.mediaType == 'live'
}, this.getTranscodingCodecs())
Expand Down
Loading

0 comments on commit 64b31e9

Please sign in to comment.