mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update create.js
This commit is contained in:
parent
5217540426
commit
76a67e3c10
1 changed files with 4 additions and 3 deletions
|
@ -9,11 +9,11 @@ const options = program
|
||||||
parser.parseNumber,
|
parser.parseNumber,
|
||||||
256
|
256
|
||||||
)
|
)
|
||||||
.option('--days <days>', 'Number of days for which to grab the program', parser.parseNumber, 1)
|
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
.opts()
|
.opts()
|
||||||
|
|
||||||
const CHANNELS_PATH = process.env.CHANNELS_PATH || 'sites/**/*.channels.xml'
|
const CHANNELS_PATH = process.env.CHANNELS_PATH || 'sites/**/*.channels.xml'
|
||||||
|
const CURR_DATE = process.env.CURR_DATE || new Date()
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
logger.info('Starting...')
|
logger.info('Starting...')
|
||||||
|
@ -33,8 +33,7 @@ async function createQueue() {
|
||||||
|
|
||||||
await api.channels.load().catch(console.error)
|
await api.channels.load().catch(console.error)
|
||||||
const files = await file.list(CHANNELS_PATH).catch(console.error)
|
const files = await file.list(CHANNELS_PATH).catch(console.error)
|
||||||
const utcDate = date.getUTC()
|
const utcDate = date.getUTC(CURR_DATE)
|
||||||
const dates = Array.from({ length: options.days }, (_, i) => utcDate.add(i, 'd'))
|
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
try {
|
try {
|
||||||
const dir = file.dirname(filepath)
|
const dir = file.dirname(filepath)
|
||||||
|
@ -44,6 +43,8 @@ async function createQueue() {
|
||||||
const config = require(file.resolve(configPath))
|
const config = require(file.resolve(configPath))
|
||||||
if (config.skip) continue
|
if (config.skip) continue
|
||||||
const filename = file.basename(filepath)
|
const filename = file.basename(filepath)
|
||||||
|
const days = config.days || 1
|
||||||
|
const dates = Array.from({ length: days }, (_, i) => utcDate.add(i, 'd'))
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
if (!channel.site || !channel.id) continue
|
if (!channel.site || !channel.id) continue
|
||||||
const found = api.channels.find({ id: channel.id })
|
const found = api.channels.find({ id: channel.id })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue