Merge pull request #5707 from iptv-org/fix-update-database-2
Fix update-database.js
This commit is contained in:
commit
6dbd982dae
|
@ -202,12 +202,12 @@ function parseResolution(streams) {
|
||||||
|
|
||||||
function parseStatus(error, prevStatus) {
|
function parseStatus(error, prevStatus) {
|
||||||
if (error) {
|
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']
|
return statuses['timeout']
|
||||||
} else if (error.includes('403')) {
|
} else if (error.includes('403')) {
|
||||||
return statuses['geo_blocked']
|
return statuses['geo_blocked']
|
||||||
} else if (['not_247', 'geo_blocked'].includes(prevStatus.code)) {
|
|
||||||
return prevStatus
|
|
||||||
}
|
}
|
||||||
return statuses['offline']
|
return statuses['offline']
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,8 @@ it('can update database', () => {
|
||||||
})
|
})
|
||||||
expect(JSON.parse(lines[4])).toMatchObject({
|
expect(JSON.parse(lines[4])).toMatchObject({
|
||||||
id: 'KayhanTV.af',
|
id: 'KayhanTV.af',
|
||||||
status: { label: 'Timeout', code: 'timeout', level: 4 },
|
status: { label: 'Geo-blocked', code: 'geo_blocked', level: 2 },
|
||||||
is_broken: true,
|
is_broken: false,
|
||||||
updated: true
|
updated: true
|
||||||
})
|
})
|
||||||
expect(JSON.parse(lines[5])).toMatchObject({
|
expect(JSON.parse(lines[5])).toMatchObject({
|
||||||
|
|
Loading…
Reference in New Issue