Update update-database.js

This commit is contained in:
Aleksandr Statciuk 2021-12-14 10:46:12 +03:00
parent 98edaa5e0b
commit 56246c015f
1 changed files with 14 additions and 1 deletions

View File

@ -200,7 +200,20 @@ function parseResolution(streams) {
return null return null
} }
// Mapping Scheme:
// ===============
// not_247 -> * = not_247
// geo_blocked -> * = geo_blocked
// offline -> online = not_247
// * -> online = online
// * -> timeout = timeout
// * -> geo_blocked = geo_blocked
// * -> offline = offline
function parseStatus(error, prevStatus) { function parseStatus(error, prevStatus) {
if (['not_247', 'geo_blocked'].includes(prevStatus.code)) return null
if(!error && prevStatus.code === 'offline') return statuses['not_247']
if(!error) return statuses['online']
if (error) { if (error) {
if (error.includes('timed out')) { if (error.includes('timed out')) {
return statuses['timeout'] return statuses['timeout']
@ -212,7 +225,7 @@ function parseStatus(error, prevStatus) {
return statuses['offline'] return statuses['offline']
} }
return statuses['online'] return null
} }
function findLogo(id) { function findLogo(id) {