From 71aa72afb41e5eb6d5f25dc3ac163f7fbce7b8ef Mon Sep 17 00:00:00 2001 From: Toha Date: Tue, 11 Nov 2025 15:34:00 +0700 Subject: [PATCH 1/3] Fix merge polluting default config. Signed-off-by: Toha --- scripts/commands/epg/grab.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/commands/epg/grab.ts b/scripts/commands/epg/grab.ts index 9ef58dc0..3f951cda 100644 --- a/scripts/commands/epg/grab.ts +++ b/scripts/commands/epg/grab.ts @@ -80,10 +80,10 @@ async function main() { const logger = new Logger({ level: options.debug ? LOG_LEVELS['debug'] : LOG_LEVELS['info'] }) logger.info('starting...') - let globalConfig: epgGrabber.Types.SiteConfig = {} + const globalConfig: epgGrabber.Types.SiteConfig = {} if (typeof options.timeout === 'number') - globalConfig = merge(globalConfig, { request: { timeout: options.timeout } }) + merge(globalConfig, { request: { timeout: options.timeout } }) if (options.proxy !== undefined) { const proxy = parseProxy(options.proxy) if ( @@ -91,11 +91,11 @@ async function main() { ['socks', 'socks5', 'socks5h', 'socks4', 'socks4a'].includes(String(proxy.protocol)) ) { const socksProxyAgent = new SocksProxyAgent(options.proxy) - globalConfig = merge(globalConfig, { + merge(globalConfig, { request: { httpAgent: socksProxyAgent, httpsAgent: socksProxyAgent } }) } else { - globalConfig = merge(globalConfig, { request: { proxy } }) + merge(globalConfig, { request: { proxy } }) } } @@ -194,8 +194,7 @@ async function main() { channel.index = index++ if (!channel.site || !channel.site_id || !channel.name) continue - let config = await loadJs(channel.getConfigPath()) - config = merge(defaultConfig, config) + const config = merge({}, defaultConfig, await loadJs(channel.getConfigPath())) if (!channel.xmltv_id) channel.xmltv_id = channel.site_id From 40eecb9bba79866abba21b24b99ca8523064fc77 Mon Sep 17 00:00:00 2001 From: Toha Date: Thu, 13 Nov 2025 18:27:31 +0700 Subject: [PATCH 2/3] Run custom channel and multiple channels test for 2 days. Signed-off-by: Toha --- tests/commands/epg/grab.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commands/epg/grab.test.ts b/tests/commands/epg/grab.test.ts index 8c311127..337c0161 100644 --- a/tests/commands/epg/grab.test.ts +++ b/tests/commands/epg/grab.test.ts @@ -69,7 +69,7 @@ describe('epg:grab', () => { }) it('can grab epg using custom channels list', () => { - const cmd = `${ENV_VAR} npm run grab --- --channels=tests/__data__/input/epg_grab/custom.channels.xml --output=tests/__data__/output/guides/custom_channels.guide.xml ` + const cmd = `${ENV_VAR} npm run grab --- --channels=tests/__data__/input/epg_grab/custom.channels.xml --output=tests/__data__/output/guides/custom_channels.guide.xml --days=2` const stdout = execSync(cmd, { encoding: 'utf8' }) if (process.env.DEBUG === 'true') console.log(cmd, stdout) @@ -79,7 +79,7 @@ describe('epg:grab', () => { }) it('can grab epg with multiple channels.xml files', () => { - const cmd = `${ENV_VAR} npm run grab --- --channels=tests/__data__/input/epg_grab/sites/**/*.channels.xml --output=tests/__data__/output/guides/multiple_channels.guide.xml` + const cmd = `${ENV_VAR} npm run grab --- --channels=tests/__data__/input/epg_grab/sites/**/*.channels.xml --output=tests/__data__/output/guides/multiple_channels.guide.xml --days=2` const stdout = execSync(cmd, { encoding: 'utf8' }) if (process.env.DEBUG === 'true') console.log(cmd, stdout) From 9000ab2db852cc76dd917c7960330a733e7b6cf3 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 14 Nov 2025 10:04:12 +0300 Subject: [PATCH 3/3] Update dependencies --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58322125..dc7fa85f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "curl-generator": "^0.5.0", "cwait": "^1.1.2", "dayjs": "^1.11.13", - "epg-grabber": "^0.46.0", + "epg-grabber": "^0.46.1", "epg-parser": "^0.3.1", "eslint": "^9.32.0", "eslint-config-prettier": "^10.1.8", @@ -5477,9 +5477,9 @@ } }, "node_modules/epg-grabber": { - "version": "0.46.0", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.0.tgz", - "integrity": "sha512-35VJZWV1tJLro5SNP9bobcVB4fWK9rTUYmtRJ1/wIOA/tktxlCvZ+n/6LoKWS89YtKujqq3jid3cVf7JSImKzA==", + "version": "0.46.1", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.1.tgz", + "integrity": "sha512-yAVcSBzMnPRrLIbFcgSevAC1ccMDh2W0IdndH6N3me9zFIvDm5+I7Q+MkNVWf6mG1x/8A2oFQC17RzKQ/bSDiw==", "dependencies": { "@freearhey/core": "^0.14.0", "@types/bluebird": "^3.5.42", @@ -14999,9 +14999,9 @@ "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" }, "epg-grabber": { - "version": "0.46.0", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.0.tgz", - "integrity": "sha512-35VJZWV1tJLro5SNP9bobcVB4fWK9rTUYmtRJ1/wIOA/tktxlCvZ+n/6LoKWS89YtKujqq3jid3cVf7JSImKzA==", + "version": "0.46.1", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.1.tgz", + "integrity": "sha512-yAVcSBzMnPRrLIbFcgSevAC1ccMDh2W0IdndH6N3me9zFIvDm5+I7Q+MkNVWf6mG1x/8A2oFQC17RzKQ/bSDiw==", "requires": { "@freearhey/core": "^0.14.0", "@types/bluebird": "^3.5.42", diff --git a/package.json b/package.json index 17b677be..6c6d8aa5 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "curl-generator": "^0.5.0", "cwait": "^1.1.2", "dayjs": "^1.11.13", - "epg-grabber": "^0.46.0", + "epg-grabber": "^0.46.1", "epg-parser": "^0.3.1", "eslint": "^9.32.0", "eslint-config-prettier": "^10.1.8",