Update db.js
This commit is contained in:
parent
52e8e617e1
commit
11cc75fa2a
@ -11,11 +11,10 @@ db.load = async function () {
|
|||||||
const codes = await epg.codes.load()
|
const codes = await epg.codes.load()
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const playlist = await parser.parsePlaylist(file)
|
const playlist = await parser.parsePlaylist(file)
|
||||||
let guides = []
|
|
||||||
for (const channel of playlist.channels) {
|
for (const channel of playlist.channels) {
|
||||||
const code = codes.find(ch => ch['tvg_id'] === channel.tvg.id)
|
const code = codes.find(ch => ch['tvg_id'] === channel.tvg.id)
|
||||||
if (code && Array.isArray(code.guides)) {
|
if (code && Array.isArray(code.guides) && code.guides.length) {
|
||||||
guides = [...guides, ...code.guides]
|
channel.tvg.url = code.guides[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
db.channels.add(channel)
|
db.channels.add(channel)
|
||||||
@ -33,8 +32,6 @@ db.load = async function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guides.length) playlist.header.attrs['url-tvg'] = guides.join(',')
|
|
||||||
|
|
||||||
db.playlists.add(playlist)
|
db.playlists.add(playlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user