From ef1f69ece6281e2e910b53c449fb8f6d34e5ef33 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Tue, 28 Oct 2025 00:32:31 +0300 Subject: [PATCH] Update grab.ts --- scripts/commands/epg/grab.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/commands/epg/grab.ts b/scripts/commands/epg/grab.ts index 65ad863e..0b90bc19 100644 --- a/scripts/commands/epg/grab.ts +++ b/scripts/commands/epg/grab.ts @@ -133,12 +133,13 @@ async function main() { siteConfig.filepath = channel.getConfigPath() - if (options.timeout !== undefined) { + if (typeof options.timeout === 'number') { siteConfig.request = { ...siteConfig.request, ...{ timeout: options.timeout } } } - if (options.delay !== undefined) siteConfig.delay = options.delay - if (options.curl !== undefined) siteConfig.curl = options.curl - if (options.proxy !== undefined) { + if (typeof options.days === 'number') siteConfig.days = options.days + if (typeof options.delay === 'number') siteConfig.delay = options.delay + if (typeof options.curl === 'boolean') siteConfig.curl = options.curl + if (typeof options.proxy === 'string') { const proxy = parseProxy(options.proxy) if ( @@ -158,9 +159,8 @@ async function main() { if (!channel.xmltv_id) channel.xmltv_id = channel.site_id - const days = options.days || siteConfig.days || 1 const currDate = dayjs.utc(process.env.CURR_DATE || new Date().toISOString()) - const dates = Array.from({ length: days }, (_, day) => currDate.add(day, 'd')) + const dates = Array.from({ length: siteConfig.days }, (_, day) => currDate.add(day, 'd')) dates.forEach((date: Dayjs) => { const key = `${channel.site}:${channel.lang}:${channel.xmltv_id}:${date.toJSON()}`