From 2009142bb47ef9420e1656362fb46b2de84922e3 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 23:08:30 +0300 Subject: [PATCH 1/5] Update tests/__data__ --- tests/__data__/expected/_readme.md | 6 +++--- .../expected/guides/bh/chaines-tv.orange.fr.epg.xml | 5 +++++ .../expected/guides/fr/chaines-tv.orange.fr.epg.xml | 5 +++++ tests/__data__/expected/guides/ge/magticom.ge.epg.xml | 3 +++ tests/__data__/expected/guides/ru/yandex.ru.epg.xml | 2 ++ tests/__data__/expected/guides/us/directv.com.epg.xml | 2 ++ tests/__data__/expected/guides/zw/dstv.com.epg.xml | 4 ++++ 7 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml create mode 100644 tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml create mode 100644 tests/__data__/expected/guides/ge/magticom.ge.epg.xml create mode 100644 tests/__data__/expected/guides/ru/yandex.ru.epg.xml create mode 100644 tests/__data__/expected/guides/us/directv.com.epg.xml create mode 100644 tests/__data__/expected/guides/zw/dstv.com.epg.xml diff --git a/tests/__data__/expected/_readme.md b/tests/__data__/expected/_readme.md index 734e3cb9..79027d19 100644 --- a/tests/__data__/expected/_readme.md +++ b/tests/__data__/expected/_readme.md @@ -12,12 +12,12 @@ To load a program guide, all you need to do is copy the link to one or more of t Country                         ChannelsEPGStatus                                                    - 🇨🇦 Canada2https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml.gzexample.com - 1https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml.gzexample.com + 🇨🇦 Canada2https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xmlexample.com + 1https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xmlexample.com -All guides also have a JSON version. To download it, just change the extension from `.xml.gz` to `.json`. +All guides also have a compressed and JSON version. To download them, simply change the extension from `.xml` to `.xml.gz` or `.json` respectively. ## Contribution diff --git a/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml b/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml new file mode 100644 index 00000000..61118187 --- /dev/null +++ b/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml @@ -0,0 +1,5 @@ + +CNN Internationalhttps://chaines-tv.orange.fr +World SportВсе о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов. +Connecting Africa. 114-я серия114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке. + \ No newline at end of file diff --git a/tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml b/tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml new file mode 100644 index 00000000..61118187 --- /dev/null +++ b/tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml @@ -0,0 +1,5 @@ + +CNN Internationalhttps://chaines-tv.orange.fr +World SportВсе о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов. +Connecting Africa. 114-я серия114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке. + \ No newline at end of file diff --git a/tests/__data__/expected/guides/ge/magticom.ge.epg.xml b/tests/__data__/expected/guides/ge/magticom.ge.epg.xml new file mode 100644 index 00000000..9a4ed48e --- /dev/null +++ b/tests/__data__/expected/guides/ge/magticom.ge.epg.xml @@ -0,0 +1,3 @@ + +CNN Internationalhttps://magticom.ge + \ No newline at end of file diff --git a/tests/__data__/expected/guides/ru/yandex.ru.epg.xml b/tests/__data__/expected/guides/ru/yandex.ru.epg.xml new file mode 100644 index 00000000..d396a1df --- /dev/null +++ b/tests/__data__/expected/guides/ru/yandex.ru.epg.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tests/__data__/expected/guides/us/directv.com.epg.xml b/tests/__data__/expected/guides/us/directv.com.epg.xml new file mode 100644 index 00000000..d396a1df --- /dev/null +++ b/tests/__data__/expected/guides/us/directv.com.epg.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tests/__data__/expected/guides/zw/dstv.com.epg.xml b/tests/__data__/expected/guides/zw/dstv.com.epg.xml new file mode 100644 index 00000000..efb0e0ab --- /dev/null +++ b/tests/__data__/expected/guides/zw/dstv.com.epg.xml @@ -0,0 +1,4 @@ + +M-Net Movies 2https://dstv.com +Robin Hood8.256.0/1S09E257 + \ No newline at end of file From 08ae31446d4dde27c92f7eb1dcecc0ecf819aa3a Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 23:08:34 +0300 Subject: [PATCH 2/5] Update update.test.js --- tests/commands/guides/update.test.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/commands/guides/update.test.js b/tests/commands/guides/update.test.js index 7b1049aa..92b74ab8 100644 --- a/tests/commands/guides/update.test.js +++ b/tests/commands/guides/update.test.js @@ -21,6 +21,14 @@ it('can generate /guides', () => { { encoding: 'utf8' } ) + const uncompressed = glob + .sync('tests/__data__/expected/guides/**/*.epg.xml') + .map(f => f.replace('tests/__data__/expected/', '')) + + uncompressed.forEach(filepath => { + expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`)) + }) + const compressed = glob .sync('tests/__data__/expected/guides/**/*.epg.xml.gz') .map(f => f.replace('tests/__data__/expected/', '')) @@ -51,22 +59,7 @@ it('will terminate process if programs not found', () => { process.exit(1) } catch (err) { expect(err.status).toBe(1) - expect(err.stdout).toBe(` -> guides:update -> node scripts/commands/guides/update.js - -Generating guides/... -Loading \"database/programs.db\"... -Loading queue... -Creating \"tests/__data__/output/guides/us/directv.com.epg.xml.gz\"... -Creating \"tests/__data__/output/guides/fr/chaines-tv.orange.fr.epg.xml.gz\"... -Creating \"tests/__data__/output/guides/bh/chaines-tv.orange.fr.epg.xml.gz\"... -Creating \"tests/__data__/output/guides/ge/magticom.ge.epg.xml.gz\"... -Creating \"tests/__data__/output/guides/ru/yandex.ru.epg.xml.gz\"... -Creating \"tests/__data__/output/guides/zw/dstv.com.epg.xml.gz\"... - -Error: No programs found -`) + expect(err.stdout.includes('Error: No programs found')).toBe(true) } }) From 82f9e400c71b8773bcae4cfb7be34422287fdfb0 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 23:08:37 +0300 Subject: [PATCH 3/5] Update update.js --- scripts/commands/guides/update.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index 300e00d7..19173b19 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -32,12 +32,16 @@ async function main() { channels = Object.values(channels) channels = _.sortBy(channels, 'id') + const xmlFilepath = `${PUBLIC_DIR}/guides/${key}.epg.xml` const gzFilepath = `${PUBLIC_DIR}/guides/${key}.epg.xml.gz` const jsonFilepath = `${PUBLIC_DIR}/guides/${key}.epg.json` - logger.info(`Creating "${gzFilepath}"...`) + logger.info(`Creating "${xmlFilepath}"...`) const xmltv = generateXMLTV({ channels, programs, date: CURR_DATE }) + await file.create(xmlFilepath, xmltv) + logger.info(`Creating "${gzFilepath}"...`) const compressed = await zip.compress(xmltv) await file.create(gzFilepath, compressed) + logger.info(`Creating "${jsonFilepath}"...`) await file.create(jsonFilepath, JSON.stringify({ channels, programs })) } From 2c280a366657eaede9513eeffb8bc7728b2e8094 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 23:08:41 +0300 Subject: [PATCH 4/5] Update update.js --- scripts/commands/readme/update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commands/readme/update.js b/scripts/commands/readme/update.js index 1afaf5d7..18f47c52 100644 --- a/scripts/commands/readme/update.js +++ b/scripts/commands/readme/update.js @@ -55,7 +55,7 @@ async function generateCountriesTable(items = []) { flag: country.flag, name: country.name, channels: item.count, - epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml.gz`, + epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml`, status: `${item.site}` }) } From 59e4d33e32bd8da73b16e4ae9fd1b1ed92bcb113 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 23:08:48 +0300 Subject: [PATCH 5/5] Update template.md --- .readme/template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readme/template.md b/.readme/template.md index 62e555f3..a73700cb 100644 --- a/.readme/template.md +++ b/.readme/template.md @@ -9,7 +9,7 @@ To load a program guide, all you need to do is copy the link to one or more of t #include "./.readme/_countries.md" -All guides also have a JSON version. To download it, just change the extension from `.xml.gz` to `.json`. +All guides also have a compressed and JSON version. To download them, simply change the extension from `.xml` to `.xml.gz` or `.json` respectively. ## Contribution