mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 10:26:41 -05:00
Delete cron package
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Logger, Timer, Storage, Collection } from '@freearhey/core'
|
||||
import { program } from 'commander'
|
||||
import { CronJob } from 'cron'
|
||||
import { QueueCreator, Job, ChannelsParser } from '../../core'
|
||||
import { Channel } from 'epg-grabber'
|
||||
import path from 'path'
|
||||
@@ -27,7 +26,6 @@ program
|
||||
value => parseInt(value),
|
||||
1
|
||||
)
|
||||
.option('--cron <expression>', 'Schedule a script run (example: "0 0 * * *")')
|
||||
.option('--gzip', 'Create a compressed version of the guide as well', false)
|
||||
.parse(process.argv)
|
||||
|
||||
@@ -41,7 +39,6 @@ export type GrabOptions = {
|
||||
delay?: string
|
||||
lang?: string
|
||||
days?: number
|
||||
cron?: string
|
||||
}
|
||||
|
||||
const options: GrabOptions = program.opts()
|
||||
@@ -79,18 +76,8 @@ async function main() {
|
||||
}
|
||||
logger.info(` found ${parsedChannels.count()} channel(s)`)
|
||||
|
||||
let runIndex = 1
|
||||
if (options.cron) {
|
||||
const cronJob = new CronJob(options.cron, async () => {
|
||||
logger.info(`run #${runIndex}:`)
|
||||
await runJob({ logger, parsedChannels })
|
||||
runIndex++
|
||||
})
|
||||
cronJob.start()
|
||||
} else {
|
||||
logger.info(`run #${runIndex}:`)
|
||||
runJob({ logger, parsedChannels })
|
||||
}
|
||||
logger.info(`run:`)
|
||||
runJob({ logger, parsedChannels })
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user