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
81dbd37a3c
commit
1a2237b0a1
1 changed files with 7 additions and 4 deletions
|
@ -24,6 +24,7 @@ async function generateGuides() {
|
||||||
await api.channels.load()
|
await api.channels.load()
|
||||||
|
|
||||||
for (const key in grouped) {
|
for (const key in grouped) {
|
||||||
|
const [__, site] = key.split('/')
|
||||||
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
||||||
let items = grouped[key]
|
let items = grouped[key]
|
||||||
|
|
||||||
|
@ -44,21 +45,23 @@ async function generateGuides() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const programs = await loadProgramsForItems(items)
|
const programs = await loadProgramsForItems(items)
|
||||||
|
let channels = Object.keys(_.groupBy(programs, 'channel'))
|
||||||
|
|
||||||
logger.info(`Creating "${filepath}"...`)
|
logger.info(`Creating "${filepath}"...`)
|
||||||
const channels = items
|
channels = channels
|
||||||
.map(item => {
|
.map(id => {
|
||||||
const channel = api.channels.find({ id: item.channel.xmltv_id })
|
const channel = api.channels.find({ id })
|
||||||
if (!channel) return null
|
if (!channel) return null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: channel.id,
|
id: channel.id,
|
||||||
display_name: channel.name,
|
display_name: channel.name,
|
||||||
url: item.channel.site,
|
url: site,
|
||||||
icon: channel.logo
|
icon: channel.logo
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(i => i)
|
.filter(i => i)
|
||||||
|
|
||||||
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