mirror of
https://github.com/iptv-org/iptv.git
synced 2024-09-06 00:02:24 +02:00
Merge pull request #5708 from iptv-org/fix-update-database-3
Fix update-database.js
This commit is contained in:
commit
e7adca5377
@ -200,7 +200,20 @@ function parseResolution(streams) {
|
||||
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) {
|
||||
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 (['not_247', 'geo_blocked'].includes(prevStatus.code)) {
|
||||
return prevStatus
|
||||
@ -212,7 +225,7 @@ function parseStatus(error, prevStatus) {
|
||||
return statuses['offline']
|
||||
}
|
||||
|
||||
return statuses['online']
|
||||
return null
|
||||
}
|
||||
|
||||
function findLogo(id) {
|
||||
|
@ -2,5 +2,5 @@
|
||||
{"name":"BBC News HD","id":"BBCNews.uk","filepath":"tests/__data__/output/channels/uk.m3u","src_country":{"name":"United Kingdom","code":"UK","lang":"eng"},"tvg_country":"UK","countries":[{"name":"United Kingdom","code":"UK","lang":"eng"}],"regions":[{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"English","code":"eng"}],"categories":[{"name":"News","slug":"news","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/eNPIQ9f.png","resolution":{"height":720,"width":null},"status":{"label":"Not 24/7","code":"not_247","level":3},"url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":3,"_id":"3TbieV1ptnZVCIdn"}
|
||||
{"name":"ATV","id":"AndorraTV.ad","filepath":"tests/__data__/output/channels/ad.m3u","src_country":{"name":"Andorra","code":"AD","lang":"cat"},"tvg_country":"AD","countries":[{"name":"Andorra","code":"AD","lang":"cat"}],"regions":[{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"Catalan","code":"cat"}],"categories":[{"name":"General","slug":"general","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/kJCjeQ4.png","resolution":{"height":720,"width":null},"status":{"label":"Offline","code":"offline","level":5},"url":"https://iptv-all.lanesh4d0w.repl.co/andorra/atv","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":true,"updated":false,"cluster_id":1,"_id":"I6cjG2xCBRFFP4sz"}
|
||||
{"name":"BBC News HD","id":"AndorraTV.ad","filepath":"tests/__data__/output/channels/uk.m3u","src_country":{"name":"United Kingdom","code":"UK","lang":"eng"},"tvg_country":"UK","countries":[{"name":"United Kingdom","code":"UK","lang":"eng"}],"regions":[{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"English","code":"eng"}],"categories":[{"name":"News","slug":"news","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/eNPIQ9f.png","resolution":{"height":720,"width":null},"status":{"label":"Not 24/7","code":"not_247","level":3},"url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":3,"_id":"WTbieV1ptnZVCIdn"}
|
||||
{"name":"Kayhan TV","id":"KayhanTV.af","filepath":"channels/af.m3u","src_country":{"name":"Afghanistan","code":"AF","lang":"pus"},"tvg_country":"AF","countries":[{"name":"Afghanistan","code":"AF","lang":"pus"}],"regions":[{"name":"Asia-Pacific","code":"APAC"},{"name":"Asia","code":"ASIA"},{"name":"South Asia","code":"SAS"}],"languages":[{"name":"Pashto","code":"pus"}],"categories":[],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/XpR1VvZ.png","resolution":{"height":720,"width":null},"status":{"label":"Geo-blocked","code":"geo_blocked","level":2},"url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":true,"updated":true,"cluster_id":1,"_id":"cFFpFVzSn6xFMUF3"}
|
||||
{"name":"Sharq","id":"Sharq.af","filepath":"channels/af.m3u","src_country":{"name":"Afghanistan","code":"AF","lang":"pus"},"tvg_country":"AF","countries":[{"name":"Afghanistan","code":"AF","lang":"pus"}],"regions":[{"name":"Asia-Pacific","code":"APAC"},{"name":"Asia","code":"ASIA"},{"name":"South Asia","code":"SAS"}],"languages":[{"name":"Pashto","code":"pus"}],"categories":[{"name":"General","slug":"general","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://ws.shoutcast.com/images/contacts/b/b9f8/b9f811c5-d210-4d0b-ae32-f467823a913e/radios/0d677ea5-46b4-4129-9359-9e5783fb6a37/0d677ea5-46b4-4129-9359-9e5783fb6a37.png","resolution":{"height":576,"width":null},"status":{"label":"Offline","code":"offline","level":5},"url":"http://51.210.199.50/hls/stream.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":true,"cluster_id":1,"_id":"u7iyA6cjtf1iWWAZ"}
|
||||
{"name":"Kayhan TV","id":"KayhanTV.af","filepath":"channels/af.m3u","src_country":{"name":"Afghanistan","code":"AF","lang":"pus"},"tvg_country":"AF","countries":[{"name":"Afghanistan","code":"AF","lang":"pus"}],"regions":[{"name":"Asia-Pacific","code":"APAC"},{"name":"Asia","code":"ASIA"},{"name":"South Asia","code":"SAS"}],"languages":[{"name":"Pashto","code":"pus"}],"categories":[],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/XpR1VvZ.png","resolution":{"height":720,"width":null},"status":{"label":"Geo-blocked","code":"geo_blocked","level":2},"url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"cFFpFVzSn6xFMUF3"}
|
||||
{"name":"Sharq","id":"Sharq.af","filepath":"channels/af.m3u","src_country":{"name":"Afghanistan","code":"AF","lang":"pus"},"tvg_country":"AF","countries":[{"name":"Afghanistan","code":"AF","lang":"pus"}],"regions":[{"name":"Asia-Pacific","code":"APAC"},{"name":"Asia","code":"ASIA"},{"name":"South Asia","code":"SAS"}],"languages":[{"name":"Pashto","code":"pus"}],"categories":[{"name":"General","slug":"general","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://ws.shoutcast.com/images/contacts/b/b9f8/b9f811c5-d210-4d0b-ae32-f467823a913e/radios/0d677ea5-46b4-4129-9359-9e5783fb6a37/0d677ea5-46b4-4129-9359-9e5783fb6a37.png","resolution":{"height":576,"width":null},"status":{"label":"Offline","code":"offline","level":5},"url":"http://51.210.199.50/hls/stream.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"u7iyA6cjtf1iWWAZ"}
|
||||
|
@ -98,7 +98,7 @@ it('can update database', () => {
|
||||
id: 'KayhanTV.af',
|
||||
status: { label: 'Geo-blocked', code: 'geo_blocked', level: 2 },
|
||||
is_broken: false,
|
||||
updated: true
|
||||
updated: false
|
||||
})
|
||||
expect(JSON.parse(lines[5])).toMatchObject({
|
||||
id: 'Sharq.af',
|
||||
|
Loading…
Reference in New Issue
Block a user