Update update.js

This commit is contained in:
Aleksandr Statciuk 2022-10-19 23:08:37 +03:00
parent 08ae31446d
commit 82f9e400c7

View file

@ -32,12 +32,16 @@ async function main() {
channels = Object.values(channels)
channels = _.sortBy(channels, 'id')
const xmlFilepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
const gzFilepath = `${PUBLIC_DIR}/guides/${key}.epg.xml.gz`
const jsonFilepath = `${PUBLIC_DIR}/guides/${key}.epg.json`
logger.info(`Creating "${gzFilepath}"...`)
logger.info(`Creating "${xmlFilepath}"...`)
const xmltv = generateXMLTV({ channels, programs, date: CURR_DATE })
await file.create(xmlFilepath, xmltv)
logger.info(`Creating "${gzFilepath}"...`)
const compressed = await zip.compress(xmltv)
await file.create(gzFilepath, compressed)
logger.info(`Creating "${jsonFilepath}"...`)
await file.create(jsonFilepath, JSON.stringify({ channels, programs }))
}