mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Load logo from config
This commit is contained in:
parent
a03ea275c2
commit
89dd00e5f0
7 changed files with 37 additions and 21 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -12,7 +12,7 @@
|
||||||
"commander": "^8.2.0",
|
"commander": "^8.2.0",
|
||||||
"csv-parser": "^3.0.0",
|
"csv-parser": "^3.0.0",
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.4",
|
||||||
"epg-grabber": "^0.15.1",
|
"epg-grabber": "^0.15.2",
|
||||||
"epg-parser": "^0.1.6",
|
"epg-parser": "^0.1.6",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"glob": "^7.2.0",
|
"glob": "^7.2.0",
|
||||||
|
@ -2007,9 +2007,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/epg-grabber": {
|
"node_modules/epg-grabber": {
|
||||||
"version": "0.15.1",
|
"version": "0.15.2",
|
||||||
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.15.2.tgz",
|
||||||
"integrity": "sha512-77lWOJllKrkv8LD1cl0bWGE+o4HRXy1vRHjvl23Yk1859jjYNPBPWj93KJUDXHBgtFA996t2R6AP9E+AC0uLWQ==",
|
"integrity": "sha512-waXwyUkp+O9Wmos95H2DUb5KyFAgm6GrFUcsWY19G7vme4qx9paH2DhKlw7pPT/aIe5sTJm/jSNG25xTK1K8Fw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"axios-cookiejar-support": "^1.0.1",
|
"axios-cookiejar-support": "^1.0.1",
|
||||||
|
@ -6431,9 +6431,9 @@
|
||||||
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
|
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
|
||||||
},
|
},
|
||||||
"epg-grabber": {
|
"epg-grabber": {
|
||||||
"version": "0.15.1",
|
"version": "0.15.2",
|
||||||
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.15.2.tgz",
|
||||||
"integrity": "sha512-77lWOJllKrkv8LD1cl0bWGE+o4HRXy1vRHjvl23Yk1859jjYNPBPWj93KJUDXHBgtFA996t2R6AP9E+AC0uLWQ==",
|
"integrity": "sha512-waXwyUkp+O9Wmos95H2DUb5KyFAgm6GrFUcsWY19G7vme4qx9paH2DhKlw7pPT/aIe5sTJm/jSNG25xTK1K8Fw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"axios-cookiejar-support": "^1.0.1",
|
"axios-cookiejar-support": "^1.0.1",
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"commander": "^8.2.0",
|
"commander": "^8.2.0",
|
||||||
"csv-parser": "^3.0.0",
|
"csv-parser": "^3.0.0",
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.4",
|
||||||
"epg-grabber": "^0.15.1",
|
"epg-grabber": "^0.15.2",
|
||||||
"epg-parser": "^0.1.6",
|
"epg-parser": "^0.1.6",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"glob": "^7.2.0",
|
"glob": "^7.2.0",
|
||||||
|
|
|
@ -46,11 +46,13 @@ async function main() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const programs = await grabber.grab(channel, config, (data, err) => {
|
const programs = await grabber.grab(channel, config, async (data, err) => {
|
||||||
|
await db.channels.update({ _id: channel._id }, { $set: { logo: data.channel.logo } })
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`[${i}/${total}] ${config.site} - ${data.channel.xmltv_id} - ${data.date.format(
|
`[${i}/${total}] ${channel.site} - ${data.id} - ${data.date.format('MMM D, YYYY')} (${
|
||||||
'MMM D, YYYY'
|
data.programs.length
|
||||||
)} (${data.programs.length} programs)`
|
} programs)`
|
||||||
)
|
)
|
||||||
|
|
||||||
if (err) logger.error(err.message)
|
if (err) logger.error(err.message)
|
||||||
|
@ -62,7 +64,7 @@ async function main() {
|
||||||
clusterLog,
|
clusterLog,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
_id: channel._id,
|
_id: channel._id,
|
||||||
site: config.site,
|
site: channel.site,
|
||||||
country: channel.country,
|
country: channel.country,
|
||||||
gid: channel.gid,
|
gid: channel.gid,
|
||||||
programs
|
programs
|
||||||
|
@ -70,6 +72,8 @@ async function main() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.channels.compact()
|
||||||
|
|
||||||
logger.info(`Done in ${timer.format('HH[h] mm[m] ss[s]')}`)
|
logger.info(`Done in ${timer.format('HH[h] mm[m] ss[s]')}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
[{"id":"BravoEast.us","name":["Bravo East"],"logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","country":"US","guides":["https://iptv-org.github.io/epg/guides/us/directv.com.epg.xml"]},{"id":"CNNInternationalEurope.us","name":["CNN International Europe","CNN Int"],"logo":"https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_cnn%2F20151026_092415%2FwebTVLogo%2Flogo_180x96.png","country":"US","guides":["https://iptv-org.github.io/epg/guides/fr/chaines-tv.orange.fr.epg.xml","https://iptv-org.github.io/epg/guides/ge/magticom.ge.epg.xml"]},{"id":"MNetMovies2.za","name":["M-Net Movies 2"],"logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","country":"ZA","guides":["https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"]}]
|
[{"id":"BravoEast.us","name":["Bravo East"],"logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","country":"US","guides":["https://iptv-org.github.io/epg/guides/us/directv.com.epg.xml"]},{"id":"CNNInternationalEurope.us","name":["CNN International Europe","CNN Int"],"logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","country":"US","guides":["https://iptv-org.github.io/epg/guides/fr/chaines-tv.orange.fr.epg.xml","https://iptv-org.github.io/epg/guides/ge/magticom.ge.epg.xml"]},{"id":"MNetMovies2.za","name":["M-Net Movies 2"],"logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","country":"ZA","guides":["https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"]}]
|
|
@ -1,4 +1,4 @@
|
||||||
{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","name":"Bravo East","site":"directv.com","channelsPath":"sites/directv.com/directv.com_us.channels.xml","configPath":"sites/directv.com/directv.com.config.js","gid":"us","cluster_id":84,"country":"US","_id":"00AluKCrCnfgrl8W"}
|
{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","name":"Bravo East","site":"directv.com","channelsPath":"sites/directv.com/directv.com_us.channels.xml","configPath":"sites/directv.com/directv.com.config.js","gid":"us","cluster_id":84,"country":"US","_id":"00AluKCrCnfgrl8W"}
|
||||||
{"lang":"fr","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"53","logo":"https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_cnn%2F20151026_092415%2FwebTVLogo%2Flogo_180x96.png","name":"CNN International Europe","site":"chaines-tv.orange.fr","channelsPath":"sites/chaines-tv.orange.fr/chaines-tv.orange.fr_fr.channels.xml","configPath":"sites/chaines-tv.orange.fr/chaines-tv.orange.fr.config.js","gid":"fr","cluster_id":1,"_id":"0Wefq0oMR3feCcuY"}
|
{"lang":"fr","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"53","logo":null,"name":"CNN International Europe","site":"chaines-tv.orange.fr","channelsPath":"sites/chaines-tv.orange.fr/chaines-tv.orange.fr_fr.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","gid":"fr","cluster_id":1,"_id":"0Wefq0oMR3feCcuY"}
|
||||||
{"lang":"ru","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"140","logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","name":"CNN Int","site":"magticom.ge","channelsPath":"sites/magticom.ge/magticom.ge_ge.channels.xml","configPath":"sites/magticom.ge/magticom.ge.config.js","gid":"ge","cluster_id":1,"_id":"1XzrxNkSF2AQNBrT"}
|
{"lang":"ru","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"140","logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","name":"CNN Int","site":"magticom.ge","channelsPath":"sites/magticom.ge/magticom.ge_ge.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","gid":"ge","cluster_id":1,"_id":"1XzrxNkSF2AQNBrT"}
|
||||||
{"lang":"en","country":"ZA","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","name":"M-Net Movies 2","site":"dstv.com","channelsPath":"sites/dstv.com/dstv.com_zw.channels.xml","configPath":"sites/dstv.com/dstv.com.config.js","gid":"zw","cluster_id":120,"_id":"1lnhXpN7g0ER5XwN"}
|
{"lang":"en","country":"ZA","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","name":"M-Net Movies 2","site":"dstv.com","channelsPath":"sites/dstv.com/dstv.com_zw.channels.xml","configPath":"sites/dstv.com/dstv.com.config.js","gid":"zw","cluster_id":120,"_id":"1lnhXpN7g0ER5XwN"}
|
||||||
|
|
|
@ -3,6 +3,9 @@ module.exports = {
|
||||||
url() {
|
url() {
|
||||||
return `https://example.com`
|
return `https://example.com`
|
||||||
},
|
},
|
||||||
|
logo() {
|
||||||
|
return 'https://example.com/logo.png'
|
||||||
|
},
|
||||||
parser() {
|
parser() {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ const path = require('path')
|
||||||
const { execSync } = require('child_process')
|
const { execSync } = require('child_process')
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||||
fs.mkdirSync('tests/__data__/output')
|
fs.mkdirSync('tests/__data__/output')
|
||||||
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
|
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
|
||||||
|
@ -12,15 +13,11 @@ beforeEach(() => {
|
||||||
)
|
)
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
'DB_DIR=tests/__data__/temp/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1 --timeout=1',
|
'DB_DIR=tests/__data__/temp/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1 --timeout=10000',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
|
||||||
})
|
|
||||||
|
|
||||||
it('can load cluster', () => {
|
it('can load cluster', () => {
|
||||||
const output = content('tests/__data__/output/logs/load-cluster/cluster_1.log')
|
const output = content('tests/__data__/output/logs/load-cluster/cluster_1.log')
|
||||||
|
|
||||||
|
@ -37,6 +34,18 @@ it('can load cluster', () => {
|
||||||
country: 'US',
|
country: 'US',
|
||||||
gid: 'ge'
|
gid: 'ge'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const database = content('tests/__data__/temp/database/channels.db')
|
||||||
|
|
||||||
|
expect(database[1]).toMatchObject({
|
||||||
|
_id: '0Wefq0oMR3feCcuY',
|
||||||
|
logo: 'https://example.com/logo.png'
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(database[2]).toMatchObject({
|
||||||
|
_id: '1XzrxNkSF2AQNBrT',
|
||||||
|
logo: 'https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function content(filepath) {
|
function content(filepath) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue