Merge pull request #5707 from iptv-org/fix-update-database-2

Fix update-database.js
This commit is contained in:
Aleksandr Statciuk 2021-12-14 10:30:00 +03:00 committed by GitHub
commit 6dbd982dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -202,12 +202,12 @@ function parseResolution(streams) {
function parseStatus(error, prevStatus) {
if (error) {
if (error.includes('timed out')) {
if (['not_247', 'geo_blocked'].includes(prevStatus.code)) {
return prevStatus
} else if (error.includes('timed out')) {
return statuses['timeout']
} else if (error.includes('403')) {
return statuses['geo_blocked']
} else if (['not_247', 'geo_blocked'].includes(prevStatus.code)) {
return prevStatus
}
return statuses['offline']
}

View File

@ -96,8 +96,8 @@ it('can update database', () => {
})
expect(JSON.parse(lines[4])).toMatchObject({
id: 'KayhanTV.af',
status: { label: 'Timeout', code: 'timeout', level: 4 },
is_broken: true,
status: { label: 'Geo-blocked', code: 'geo_blocked', level: 2 },
is_broken: false,
updated: true
})
expect(JSON.parse(lines[5])).toMatchObject({