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
043d738c95
commit
b39bb3edc2
1 changed files with 6 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
const { db, logger, file, xml } = require('../core')
|
const { db, logger, file, xml } = require('../core')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
|
||||||
let channels = []
|
let channels = {}
|
||||||
let programs = []
|
let programs = {}
|
||||||
let sources = {}
|
let sources = {}
|
||||||
|
|
||||||
const DB_DIR = process.env.DB_DIR || 'scripts/database'
|
const DB_DIR = process.env.DB_DIR || 'scripts/database'
|
||||||
|
@ -22,7 +22,7 @@ async function generateMainXML() {
|
||||||
|
|
||||||
const output = {}
|
const output = {}
|
||||||
const filteredChannels = Object.keys(programs)
|
const filteredChannels = Object.keys(programs)
|
||||||
output.channels = channels
|
output.channels = _.flatten(Object.values(channels))
|
||||||
.filter(c => filteredChannels.includes(c.id))
|
.filter(c => filteredChannels.includes(c.id))
|
||||||
.map(c => {
|
.map(c => {
|
||||||
c.site = sources[c.id]
|
c.site = sources[c.id]
|
||||||
|
@ -36,7 +36,7 @@ async function generateMainXML() {
|
||||||
async function generateCountries() {
|
async function generateCountries() {
|
||||||
logger.info(`Generating countries/...`)
|
logger.info(`Generating countries/...`)
|
||||||
|
|
||||||
const countryCodes = ['US', 'ZA']
|
const countryCodes = Object.keys(programs).map(id => channels[id].country)
|
||||||
|
|
||||||
for (let code of countryCodes) {
|
for (let code of countryCodes) {
|
||||||
const output = {
|
const output = {
|
||||||
|
@ -44,7 +44,7 @@ async function generateCountries() {
|
||||||
programs: []
|
programs: []
|
||||||
}
|
}
|
||||||
|
|
||||||
output.channels = channels
|
output.channels = _.flatten(Object.values(channels))
|
||||||
.filter(c => c.country === code)
|
.filter(c => c.country === code)
|
||||||
.map(c => {
|
.map(c => {
|
||||||
c.site = sources[c.id]
|
c.site = sources[c.id]
|
||||||
|
@ -86,7 +86,7 @@ async function loadChannels() {
|
||||||
output[item.xmltv_id].name = _.uniq(output[item.xmltv_id].name)
|
output[item.xmltv_id].name = _.uniq(output[item.xmltv_id].name)
|
||||||
})
|
})
|
||||||
|
|
||||||
return Object.values(output)
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadPrograms() {
|
async function loadPrograms() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue