mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
wip
This commit is contained in:
parent
aeecc61bd7
commit
299cf26cd6
3 changed files with 21 additions and 139379 deletions
127493
.gh-pages/api/channels.json
127493
.gh-pages/api/channels.json
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -20,15 +20,15 @@ async function main() {
|
||||||
main()
|
main()
|
||||||
|
|
||||||
async function setUp() {
|
async function setUp() {
|
||||||
channels = await db.channels.find({}).sort({ xmltv_id: 1 })
|
channels = await loadChannels()
|
||||||
programs = await db.programs.find({})
|
programs = await loadPrograms()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateChannelsJson() {
|
async function loadChannels() {
|
||||||
logger.info('Generating channels.json...')
|
let items = await db.channels.find({}).sort({ xmltv_id: 1 })
|
||||||
|
|
||||||
let output = {}
|
let output = {}
|
||||||
channels.forEach(channel => {
|
items.forEach(channel => {
|
||||||
if (!output[channel.xmltv_id]) {
|
if (!output[channel.xmltv_id]) {
|
||||||
const countryCode = channel.xmltv_id.split('.')[1]
|
const countryCode = channel.xmltv_id.split('.')[1]
|
||||||
|
|
||||||
|
@ -49,16 +49,11 @@ async function generateChannelsJson() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await file.create(
|
return Object.values(output)
|
||||||
`${PUBLIC_DIR}/api/channels.json`,
|
|
||||||
JSON.stringify(Object.values(output), null, 2)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateProgramsJson() {
|
async function loadPrograms() {
|
||||||
logger.info('Generating programs.json...')
|
let items = await db.programs.find({})
|
||||||
|
|
||||||
let items = programs
|
|
||||||
|
|
||||||
items = _.sortBy(items, ['channel', 'start'])
|
items = _.sortBy(items, ['channel', 'start'])
|
||||||
items = _.groupBy(items, 'channel')
|
items = _.groupBy(items, 'channel')
|
||||||
|
@ -80,7 +75,6 @@ async function generateProgramsJson() {
|
||||||
}
|
}
|
||||||
|
|
||||||
slots[slotId].forEach(item => {
|
slots[slotId].forEach(item => {
|
||||||
// program.site = item.site
|
|
||||||
if (item.title) program.title.push({ lang: item.lang, value: item.title })
|
if (item.title) program.title.push({ lang: item.lang, value: item.title })
|
||||||
if (item.description)
|
if (item.description)
|
||||||
program.description.push({
|
program.description.push({
|
||||||
|
@ -103,7 +97,19 @@ async function generateProgramsJson() {
|
||||||
items[channel] = Object.values(slots)
|
items[channel] = Object.values(slots)
|
||||||
}
|
}
|
||||||
|
|
||||||
await file.create(`${PUBLIC_DIR}/api/programs.json`, JSON.stringify(items, null, 2))
|
return items
|
||||||
|
}
|
||||||
|
|
||||||
|
async function generateChannelsJson() {
|
||||||
|
logger.info('Generating channels.json...')
|
||||||
|
|
||||||
|
await file.create(`${PUBLIC_DIR}/api/channels.json`, JSON.stringify(channels, null, 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
async function generateProgramsJson() {
|
||||||
|
logger.info('Generating programs.json...')
|
||||||
|
|
||||||
|
await file.create(`${PUBLIC_DIR}/api/programs.json`, JSON.stringify(programs, null, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function generateGuideXML() {
|
// async function generateGuideXML() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue