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
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 }))
}
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: `
`
})
}
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 | Channels | EPG | Status |
- 🇨🇦 Canada | 2 | https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml.gz |  |
- 1 | https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml.gz |  |
+ 🇨🇦 Canada | 2 | https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml |  |
+ 1 | https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml |  |
-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
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)
}
})