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()
|
||||
|
||||
for (const key in grouped) {
|
||||
const [__, site] = key.split('/')
|
||||
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
||||
let items = grouped[key]
|
||||
|
||||
|
@ -44,21 +45,23 @@ async function generateGuides() {
|
|||
}
|
||||
|
||||
const programs = await loadProgramsForItems(items)
|
||||
let channels = Object.keys(_.groupBy(programs, 'channel'))
|
||||
|
||||
logger.info(`Creating "${filepath}"...`)
|
||||
const channels = items
|
||||
.map(item => {
|
||||
const channel = api.channels.find({ id: item.channel.xmltv_id })
|
||||
channels = channels
|
||||
.map(id => {
|
||||
const channel = api.channels.find({ id })
|
||||
if (!channel) return null
|
||||
|
||||
return {
|
||||
id: channel.id,
|
||||
display_name: channel.name,
|
||||
url: item.channel.site,
|
||||
url: site,
|
||||
icon: channel.logo
|
||||
}
|
||||
})
|
||||
.filter(i => i)
|
||||
|
||||
const output = grabber.convertToXMLTV({ channels, programs })
|
||||
await file.create(filepath, output)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue