Load logo from config

This commit is contained in:
Aleksandr Statciuk 2022-01-16 01:33:40 +03:00
parent a03ea275c2
commit 89dd00e5f0
7 changed files with 37 additions and 21 deletions

View file

@ -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"]}]

View file

@ -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":"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":"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":"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":"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"}

View file

@ -3,6 +3,9 @@ module.exports = {
url() {
return `https://example.com`
},
logo() {
return 'https://example.com/logo.png'
},
parser() {
return []
}

View file

@ -3,6 +3,7 @@ const path = require('path')
const { execSync } = require('child_process')
beforeEach(() => {
fs.rmdirSync('tests/__data__/temp', { recursive: true })
fs.rmdirSync('tests/__data__/output', { recursive: true })
fs.mkdirSync('tests/__data__/output')
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
@ -12,15 +13,11 @@ beforeEach(() => {
)
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' }
)
})
afterEach(() => {
fs.rmdirSync('tests/__data__/temp', { recursive: true })
})
it('can load cluster', () => {
const output = content('tests/__data__/output/logs/load-cluster/cluster_1.log')
@ -37,6 +34,18 @@ it('can load cluster', () => {
country: 'US',
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) {