mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update create-queue.js
This commit is contained in:
parent
1da2821900
commit
0c87e23011
2 changed files with 4 additions and 3 deletions
|
@ -10,10 +10,11 @@ const options = program
|
||||||
256
|
256
|
||||||
)
|
)
|
||||||
.option('--days <days>', 'Number of days for which to grab the program', parser.parseNumber, 1)
|
.option('--days <days>', 'Number of days for which to grab the program', parser.parseNumber, 1)
|
||||||
.option('--channels <channels>', 'Set path to channels.xml file', 'sites/**/*.channels.xml')
|
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
.opts()
|
.opts()
|
||||||
|
|
||||||
|
const CHANNELS_PATH = process.env.CHANNELS_PATH || 'sites/**/*.channels.xml'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
logger.info('Starting...')
|
logger.info('Starting...')
|
||||||
logger.info(`Number of clusters: ${options.maxClusters}`)
|
logger.info(`Number of clusters: ${options.maxClusters}`)
|
||||||
|
@ -30,7 +31,7 @@ async function createQueue() {
|
||||||
|
|
||||||
let queue = {}
|
let queue = {}
|
||||||
|
|
||||||
const files = await file.list(options.channels)
|
const files = await file.list(CHANNELS_PATH)
|
||||||
const utcDate = date.getUTC()
|
const utcDate = date.getUTC()
|
||||||
const dates = Array.from({ length: options.days }, (_, i) => utcDate.add(i, 'd'))
|
const dates = Array.from({ length: options.days }, (_, i) => utcDate.add(i, 'd'))
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ beforeEach(() => {
|
||||||
fs.mkdirSync('tests/__data__/output')
|
fs.mkdirSync('tests/__data__/output')
|
||||||
|
|
||||||
const stdout = execSync(
|
const stdout = execSync(
|
||||||
'DB_DIR=tests/__data__/output/database node scripts/commands/create-queue.js --channels=tests/__data__/input/sites/*.channels.xml --max-clusters=1 --days=2',
|
'DB_DIR=tests/__data__/output/database CHANNELS_PATH=tests/__data__/input/sites/*.channels.xml node scripts/commands/create-queue.js --max-clusters=1 --days=2',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue