Update format.js

pull/4034/head
Aleksandr Statciuk 3 years ago
parent aebe50b3d1
commit a51cb33c19

@ -68,13 +68,9 @@ async function updatePlaylist(playlist) {
await checker await checker
.checkStream(channel.data) .checkStream(channel.data)
.then(result => { .then(result => {
if (result.status.ok || result.status.reason.includes('timed out')) { if (config.status) updateStatus(channel, result.status)
if (config.status) updateStatus(channel, null) if (config.resolution && result.status.ok)
if (config.resolution) updateResolution(channel, result.status.metadata) updateResolution(channel, result.status.metadata)
} else {
if (config.debug) log.print(` ERR: ${channel.url} (${result.status.reason})\n`)
if (config.status) updateStatus(channel, 'Offline')
}
}) })
.catch(err => { .catch(err => {
if (config.debug) log.print(` ERR: ${channel.url} (${err.message})\n`) if (config.debug) log.print(` ERR: ${channel.url} (${err.message})\n`)
@ -107,7 +103,17 @@ function addMissingData(channel) {
} }
function updateStatus(channel, status) { function updateStatus(channel, status) {
channel.status = status if (status.ok) {
channel.status = null
} else if (status.reason.includes('timed out')) {
// nothing
} else if (status.reason.includes('403')) {
channel.status = 'Geo-blocked'
if (config.debug) log.print(` ERR: ${channel.url} (${status.reason})\n`)
} else {
channel.status = 'Offline'
if (config.debug) log.print(` ERR: ${channel.url} (${status.reason})\n`)
}
} }
function updateResolution(channel, metadata) { function updateResolution(channel, metadata) {

Loading…
Cancel
Save