mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
Merge pull request #2928 from tohenk/fix-merge-config
Fix merge polluting default config.
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -51,7 +51,7 @@
|
|||||||
"curl-generator": "^0.5.0",
|
"curl-generator": "^0.5.0",
|
||||||
"cwait": "^1.1.2",
|
"cwait": "^1.1.2",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"epg-grabber": "^0.46.0",
|
"epg-grabber": "^0.46.1",
|
||||||
"epg-parser": "^0.3.1",
|
"epg-parser": "^0.3.1",
|
||||||
"eslint": "^9.32.0",
|
"eslint": "^9.32.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
@@ -5477,9 +5477,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/epg-grabber": {
|
"node_modules/epg-grabber": {
|
||||||
"version": "0.46.0",
|
"version": "0.46.1",
|
||||||
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.0.tgz",
|
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.1.tgz",
|
||||||
"integrity": "sha512-35VJZWV1tJLro5SNP9bobcVB4fWK9rTUYmtRJ1/wIOA/tktxlCvZ+n/6LoKWS89YtKujqq3jid3cVf7JSImKzA==",
|
"integrity": "sha512-yAVcSBzMnPRrLIbFcgSevAC1ccMDh2W0IdndH6N3me9zFIvDm5+I7Q+MkNVWf6mG1x/8A2oFQC17RzKQ/bSDiw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@freearhey/core": "^0.14.0",
|
"@freearhey/core": "^0.14.0",
|
||||||
"@types/bluebird": "^3.5.42",
|
"@types/bluebird": "^3.5.42",
|
||||||
@@ -14999,9 +14999,9 @@
|
|||||||
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA=="
|
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA=="
|
||||||
},
|
},
|
||||||
"epg-grabber": {
|
"epg-grabber": {
|
||||||
"version": "0.46.0",
|
"version": "0.46.1",
|
||||||
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.0.tgz",
|
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.46.1.tgz",
|
||||||
"integrity": "sha512-35VJZWV1tJLro5SNP9bobcVB4fWK9rTUYmtRJ1/wIOA/tktxlCvZ+n/6LoKWS89YtKujqq3jid3cVf7JSImKzA==",
|
"integrity": "sha512-yAVcSBzMnPRrLIbFcgSevAC1ccMDh2W0IdndH6N3me9zFIvDm5+I7Q+MkNVWf6mG1x/8A2oFQC17RzKQ/bSDiw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@freearhey/core": "^0.14.0",
|
"@freearhey/core": "^0.14.0",
|
||||||
"@types/bluebird": "^3.5.42",
|
"@types/bluebird": "^3.5.42",
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
"curl-generator": "^0.5.0",
|
"curl-generator": "^0.5.0",
|
||||||
"cwait": "^1.1.2",
|
"cwait": "^1.1.2",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"epg-grabber": "^0.46.0",
|
"epg-grabber": "^0.46.1",
|
||||||
"epg-parser": "^0.3.1",
|
"epg-parser": "^0.3.1",
|
||||||
"eslint": "^9.32.0",
|
"eslint": "^9.32.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ async function main() {
|
|||||||
const logger = new Logger({ level: options.debug ? LOG_LEVELS['debug'] : LOG_LEVELS['info'] })
|
const logger = new Logger({ level: options.debug ? LOG_LEVELS['debug'] : LOG_LEVELS['info'] })
|
||||||
|
|
||||||
logger.info('starting...')
|
logger.info('starting...')
|
||||||
let globalConfig: epgGrabber.Types.SiteConfig = {}
|
const globalConfig: epgGrabber.Types.SiteConfig = {}
|
||||||
|
|
||||||
if (typeof options.timeout === 'number')
|
if (typeof options.timeout === 'number')
|
||||||
globalConfig = merge(globalConfig, { request: { timeout: options.timeout } })
|
merge(globalConfig, { request: { timeout: options.timeout } })
|
||||||
if (options.proxy !== undefined) {
|
if (options.proxy !== undefined) {
|
||||||
const proxy = parseProxy(options.proxy)
|
const proxy = parseProxy(options.proxy)
|
||||||
if (
|
if (
|
||||||
@@ -91,11 +91,11 @@ async function main() {
|
|||||||
['socks', 'socks5', 'socks5h', 'socks4', 'socks4a'].includes(String(proxy.protocol))
|
['socks', 'socks5', 'socks5h', 'socks4', 'socks4a'].includes(String(proxy.protocol))
|
||||||
) {
|
) {
|
||||||
const socksProxyAgent = new SocksProxyAgent(options.proxy)
|
const socksProxyAgent = new SocksProxyAgent(options.proxy)
|
||||||
globalConfig = merge(globalConfig, {
|
merge(globalConfig, {
|
||||||
request: { httpAgent: socksProxyAgent, httpsAgent: socksProxyAgent }
|
request: { httpAgent: socksProxyAgent, httpsAgent: socksProxyAgent }
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
globalConfig = merge(globalConfig, { request: { proxy } })
|
merge(globalConfig, { request: { proxy } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +194,7 @@ async function main() {
|
|||||||
channel.index = index++
|
channel.index = index++
|
||||||
if (!channel.site || !channel.site_id || !channel.name) continue
|
if (!channel.site || !channel.site_id || !channel.name) continue
|
||||||
|
|
||||||
let config = await loadJs(channel.getConfigPath())
|
const config = merge({}, defaultConfig, await loadJs(channel.getConfigPath()))
|
||||||
config = merge(defaultConfig, config)
|
|
||||||
|
|
||||||
if (!channel.xmltv_id) channel.xmltv_id = channel.site_id
|
if (!channel.xmltv_id) channel.xmltv_id = channel.site_id
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ describe('epg:grab', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can grab epg using custom channels list', () => {
|
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' })
|
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
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', () => {
|
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' })
|
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user