Merge branch 'main' into enhancement/radio

This commit is contained in:
Core 2022-05-24 23:38:52 +01:00 committed by GitHub
commit d407a55bc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 291 additions and 656 deletions

View file

@ -949,7 +949,12 @@ const app = new Vue({
silent: true,
});
}
setTimeout(() => {
let i = (document.querySelector('#apple-music-player').src ?? "")
if (i.endsWith(".m3u8") || i.endsWith(".m3u")){
this._playRadioStream(i)
}
}, 1500)
})
@ -4393,25 +4398,23 @@ const app = new Vue({
app.skipToNextItem()
});
},
checkForUpdate() {
ipcRenderer.send('check-for-update')
document.getElementById('settings.option.general.updateCider.check').innerHTML = 'Checking...'
notyf.success('Checking for update in background...')
ipcRenderer.on('update-response', (event, res) => {
if (res === "update-not-available") {
notyf.error(app.getLz(`settings.notyf.updateCider.${res}`))
} else if (res === "update-downloaded") {
notyf.success(app.getLz(`settings.notyf.updateCider.${res}`))
} else if (res === "update-error") {
notyf.error(app.getLz(`settings.notyf.updateCider.${res}`))
} else if (res === "update-timeout") {
notyf.error(app.getLz(`settings.notyf.updateCider.${res}`))
}
document.getElementById('settings.option.general.updateCider.check').innerHTML = app.getLz('term.check')
})
},
authCC() {
ipcRenderer.send('cc-auth')
},
_playRadioStream(e) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = process;
xhr.open("GET", e , true);
xhr.send();
let self = this
function process() {
if (xhr.readyState == 4) {
let sources = xhr.responseText.match(/^(?!#)(?!\s).*$/mg).filter(function(element){return (element);});
// Load first source
let src = sources[0];
app.mk._services.mediaItemPlayback._currentPlayer._playAssetURL(src, false)
}
}
}
}
})