mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
commit
2e4d851dfd
8 changed files with 19 additions and 3 deletions
|
@ -32,11 +32,13 @@ async function main() {
|
||||||
channels = Object.values(channels)
|
channels = Object.values(channels)
|
||||||
channels = _.sortBy(channels, 'id')
|
channels = _.sortBy(channels, 'id')
|
||||||
|
|
||||||
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml.gz`
|
const gzFilepath = `${PUBLIC_DIR}/guides/${key}.epg.xml.gz`
|
||||||
logger.info(`Creating "${filepath}"...`)
|
const jsonFilepath = `${PUBLIC_DIR}/guides/${key}.epg.json`
|
||||||
|
logger.info(`Creating "${gzFilepath}"...`)
|
||||||
const xmltv = generateXMLTV({ channels, programs, date: CURR_DATE })
|
const xmltv = generateXMLTV({ channels, programs, date: CURR_DATE })
|
||||||
const compressed = await zip.compress(xmltv)
|
const compressed = await zip.compress(xmltv)
|
||||||
await file.create(filepath, compressed)
|
await file.create(gzFilepath, compressed)
|
||||||
|
await file.create(jsonFilepath, JSON.stringify({ channels, programs }))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!total) {
|
if (!total) {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[{"id":"CNNInternationalEurope.us","name":"CNN International","site":"chaines-tv.orange.fr","site_id":"53","lang":"fr","logo":"https://i.imgur.com/2BXCg0x.jpg","url":"https://chaines-tv.orange.fr"}],"programs":[{"site":"chaines-tv.orange.fr","channel":"CNNInternationalEurope.us","titles":[{"value":"World Sport","lang":"fr"}],"sub_titles":[],"descriptions":[{"value":"Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.","lang":"fr"}],"icon":{"src":""},"episodeNumbers":[],"date":null,"start":1641825900000,"stop":1641826800000,"urls":[],"ratings":[],"categories":[],"directors":[],"actors":[],"writers":[],"adapters":[],"producers":[],"composers":[],"editors":[],"presenters":[],"commentators":[],"guests":[]},{"site":"chaines-tv.orange.fr","channel":"CNNInternationalEurope.us","titles":[{"value":"Connecting Africa. 114-я серия","lang":"fr"}],"sub_titles":[],"descriptions":[{"value":"114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке.","lang":"fr"}],"icon":{"src":""},"episodeNumbers":[],"date":null,"start":1641843900000,"stop":1641844800000,"urls":[],"ratings":[],"categories":[],"directors":[],"actors":[],"writers":[],"adapters":[],"producers":[],"composers":[],"editors":[],"presenters":[],"commentators":[],"guests":[]}]}
|
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[{"id":"CNNInternationalEurope.us","name":"CNN International","site":"chaines-tv.orange.fr","site_id":"53","lang":"fr","logo":"https://i.imgur.com/2BXCg0x.jpg","url":"https://chaines-tv.orange.fr"}],"programs":[{"site":"chaines-tv.orange.fr","channel":"CNNInternationalEurope.us","titles":[{"value":"World Sport","lang":"fr"}],"sub_titles":[],"descriptions":[{"value":"Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.","lang":"fr"}],"icon":{"src":""},"episodeNumbers":[],"date":null,"start":1641825900000,"stop":1641826800000,"urls":[],"ratings":[],"categories":[],"directors":[],"actors":[],"writers":[],"adapters":[],"producers":[],"composers":[],"editors":[],"presenters":[],"commentators":[],"guests":[]},{"site":"chaines-tv.orange.fr","channel":"CNNInternationalEurope.us","titles":[{"value":"Connecting Africa. 114-я серия","lang":"fr"}],"sub_titles":[],"descriptions":[{"value":"114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке.","lang":"fr"}],"icon":{"src":""},"episodeNumbers":[],"date":null,"start":1641843900000,"stop":1641844800000,"urls":[],"ratings":[],"categories":[],"directors":[],"actors":[],"writers":[],"adapters":[],"producers":[],"composers":[],"editors":[],"presenters":[],"commentators":[],"guests":[]}]}
|
1
tests/__data__/expected/guides/ge/magticom.ge.epg.json
Normal file
1
tests/__data__/expected/guides/ge/magticom.ge.epg.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[{"id":"CNNInternationalEurope.us","name":"CNN International","site":"magticom.ge","site_id":"140","lang":"ru","logo":"https://i.imgur.com/2BXCg0x.jpg","url":"https://magticom.ge"}],"programs":[]}
|
1
tests/__data__/expected/guides/ru/yandex.ru.epg.json
Normal file
1
tests/__data__/expected/guides/ru/yandex.ru.epg.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[],"programs":[]}
|
1
tests/__data__/expected/guides/us/directv.com.epg.json
Normal file
1
tests/__data__/expected/guides/us/directv.com.epg.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[],"programs":[]}
|
1
tests/__data__/expected/guides/zw/dstv.com.epg.json
Normal file
1
tests/__data__/expected/guides/zw/dstv.com.epg.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"channels":[{"id":"MNetMovies2.za","name":"M-Net Movies 2","site":"dstv.com","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","lang":"en","logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","url":"https://dstv.com"}],"programs":[{"site":"dstv.com","channel":"MNetMovies2.za","titles":[{"value":"Robin Hood","lang":"en"}],"sub_titles":[],"descriptions":[],"icon":{"src":""},"episodeNumbers":[{"system":"xmltv_ns","value":"8.256.0/1"},{"system":"onscreen","value":"S09E257"}],"date":null,"start":1641822300000,"stop":1641829200000,"urls":[],"ratings":[],"categories":[],"directors":[],"actors":[],"writers":[],"adapters":[],"producers":[],"composers":[],"editors":[],"presenters":[],"commentators":[],"guests":[]}]}
|
|
@ -28,6 +28,14 @@ it('can generate /guides', () => {
|
||||||
compressed.forEach(filepath => {
|
compressed.forEach(filepath => {
|
||||||
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
|
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const json = glob
|
||||||
|
.sync('tests/__data__/expected/guides/**/*.json')
|
||||||
|
.map(f => f.replace('tests/__data__/expected/', ''))
|
||||||
|
|
||||||
|
json.forEach(filepath => {
|
||||||
|
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('will terminate process if programs not found', () => {
|
it('will terminate process if programs not found', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue