Update create-database.js
This commit is contained in:
parent
219539b70c
commit
244afb8088
|
@ -42,7 +42,7 @@ parser.parseChannelName = function (string) {
|
||||||
parser.parseCountryCode = function (filepath) {
|
parser.parseCountryCode = function (filepath) {
|
||||||
if (!filepath) return null
|
if (!filepath) return null
|
||||||
const basename = file.basename(filepath)
|
const basename = file.basename(filepath)
|
||||||
const [code] = basename.split('_') || [null]
|
const [_, code] = basename.match(/^([a-z]{2})(_|\.)/) || [null, null]
|
||||||
|
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
{"title":"ATV","id":"ATV.ad","filepath":"tests/__data__/input/channels/ad.m3u","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_broken":true,"updated":false,"cluster_id":1,"_id":"verufR2ehwdsfou3"}
|
{"title":"ATV","id":"ATV.ad","filepath":"tests/__data__/input/channels/ad.m3u","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_broken":true,"updated":false,"cluster_id":1,"_id":"verufR2ehwdsfou3"}
|
||||||
{"title":"Fox Sports 2 Asia (Thai)","id":"FoxSports2AsiaThai.us","filepath":"tests/__data__/input/channels/us_blocked.m3u","resolution":{"height":720,"width":null},"status":{"label":"","code":"online","level":1},"url":"https://example.com/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_broken":false,"updated":true,"cluster_id":1,"_id":"sLG04kZhqlEcYc25"}
|
{"title":"Fox Sports 2 Asia (Thai)","id":"FoxSports2AsiaThai.us","filepath":"tests/__data__/input/channels/us_blocked.m3u","resolution":{"height":720,"width":null},"status":{"label":"","code":"online","level":1},"url":"https://example.com/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_broken":false,"updated":true,"cluster_id":1,"_id":"sLG04kZhqlEcYc25"}
|
||||||
|
{"id":null,"title":"1A Network","filepath":"tests/__data__/input/channels/unsorted.m3u","resolution":{"height":720,"width":null},"status":{"label":"","code":"online","level":1},"url":"https://simultv.s.llnwi.net/n4s4/2ANetwork/interlink.m3u8","http":{"referrer":"","user-agent":""},"is_broken":false,"updated":true,"cluster_id":1,"_id":"Jruf9KFXRsa5BjYj"}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#EXTM3U
|
||||||
|
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",1A Network (720p)
|
||||||
|
https://simultv.s.llnwi.net/n4s4/2ANetwork/interlink.m3u8
|
|
@ -27,7 +27,8 @@ it('can create database', () => {
|
||||||
expect(output).toEqual(
|
expect(output).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
expect.objectContaining(expected[0]),
|
expect.objectContaining(expected[0]),
|
||||||
expect.objectContaining(expected[1])
|
expect.objectContaining(expected[1]),
|
||||||
|
expect.objectContaining(expected[2])
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue