mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update-guides.js
This commit is contained in:
parent
4ec6082019
commit
e020e2707f
1 changed files with 7 additions and 3 deletions
|
@ -24,9 +24,11 @@ async function generateGuides() {
|
||||||
for (const key in grouped) {
|
for (const key in grouped) {
|
||||||
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
||||||
const criticalErrors = []
|
const criticalErrors = []
|
||||||
const channels = []
|
let channels = {}
|
||||||
let programs = []
|
let programs = []
|
||||||
for (const item of grouped[key]) {
|
for (const item of grouped[key]) {
|
||||||
|
if (channels[item.channel.xmltv_id]) continue
|
||||||
|
|
||||||
if (item.error) {
|
if (item.error) {
|
||||||
const error = {
|
const error = {
|
||||||
xmltv_id: item.channel.xmltv_id,
|
xmltv_id: item.channel.xmltv_id,
|
||||||
|
@ -65,17 +67,19 @@ async function generateGuides() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
channels.push({
|
channels[channel.id] = {
|
||||||
xmltv_id: channel.id,
|
xmltv_id: channel.id,
|
||||||
name: channel.name,
|
name: channel.name,
|
||||||
logo: channel.logo,
|
logo: channel.logo,
|
||||||
site: item.channel.site
|
site: item.channel.site
|
||||||
})
|
}
|
||||||
|
|
||||||
programs = programs.concat(itemPrograms)
|
programs = programs.concat(itemPrograms)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channels = Object.values(channels)
|
||||||
|
|
||||||
logger.info(`Creating "${filepath}"...`)
|
logger.info(`Creating "${filepath}"...`)
|
||||||
const output = grabber.convertToXMLTV({ channels, programs })
|
const output = grabber.convertToXMLTV({ channels, programs })
|
||||||
await file.create(filepath, output)
|
await file.create(filepath, output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue