diff --git a/.readme/template.md b/.readme/template.md index 6ad25984..9dc85d98 100644 --- a/.readme/template.md +++ b/.readme/template.md @@ -9,8 +9,6 @@ To load a program guide, all you need to do is copy the link to one or more of t #include "./.readme/_countries.md" -To use a compressed version of the files, add `.gz` to the end of the filename. - ## API The API documentation can be found in the [iptv-org/api](https://github.com/iptv-org/api) repository. diff --git a/scripts/commands/api/update.js b/scripts/commands/api/update.js index e705db67..f11afa47 100644 --- a/scripts/commands/api/update.js +++ b/scripts/commands/api/update.js @@ -24,7 +24,7 @@ async function main() { channel: channel.id, site: channel.site, lang: channel.lang, - url: `https://iptv-org.github.io/epg/guides/${suffix}/${site}.epg.xml` + url: `https://iptv-org.github.io/epg/guides/${suffix}/${site}.epg.xml.gz` }) } } catch (err) { diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index 59e624a5..304d4ccc 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -31,12 +31,11 @@ async function main() { channels = Object.values(channels) channels = _.sortBy(channels, 'id') - const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml` + const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml.gz` logger.info(`Creating "${filepath}"...`) - const output = generateXMLTV({ channels, programs, date: CURR_DATE }) - await file.create(filepath, output) - const compressed = await zip.compress(output) - await file.create(filepath + '.gz', compressed) + const xmltv = generateXMLTV({ channels, programs, date: CURR_DATE }) + const compressed = await zip.compress(xmltv) + await file.create(filepath, compressed) } if (!total) { diff --git a/scripts/commands/readme/update.js b/scripts/commands/readme/update.js index 18f47c52..1afaf5d7 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`, + epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml.gz`, status: `${item.site}` }) } diff --git a/tests/__data__/expected/_readme.md b/tests/__data__/expected/_readme.md index c0f5df2f..1f392846 100644 --- a/tests/__data__/expected/_readme.md +++ b/tests/__data__/expected/_readme.md @@ -12,13 +12,11 @@ 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.xmlexample.com - 1https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xmlexample.com + 🇨🇦 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 -To use a compressed version of the files, add `.gz` to the end of the filename. - ## API The API documentation can be found in the [iptv-org/api](https://github.com/iptv-org/api) repository. diff --git a/tests/__data__/expected/api/guides.json b/tests/__data__/expected/api/guides.json index e016b25e..fdf08bc4 100644 --- a/tests/__data__/expected/api/guides.json +++ b/tests/__data__/expected/api/guides.json @@ -1 +1 @@ -[{"channel":"CNNInternationalEurope.us","site":"example.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml"},{"channel":"CNNInternationalEurope.us","site":"example.com","lang":"ru","url":"https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml"},{"channel":"CNNInternationalEurope2.us","site":"example.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml"}] \ No newline at end of file +[{"channel":"CNNInternationalEurope.us","site":"example.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml.gz"},{"channel":"CNNInternationalEurope.us","site":"example.com","lang":"ru","url":"https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml.gz"},{"channel":"CNNInternationalEurope2.us","site":"example.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml.gz"}] \ No newline at end of file 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 deleted file mode 100644 index 61118187..00000000 --- a/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml +++ /dev/null @@ -1,5 +0,0 @@ - -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 deleted file mode 100644 index 61118187..00000000 --- a/tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml +++ /dev/null @@ -1,5 +0,0 @@ - -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 deleted file mode 100644 index 9a4ed48e..00000000 --- a/tests/__data__/expected/guides/ge/magticom.ge.epg.xml +++ /dev/null @@ -1,3 +0,0 @@ - -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 deleted file mode 100644 index d396a1df..00000000 --- a/tests/__data__/expected/guides/ru/yandex.ru.epg.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ 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 deleted file mode 100644 index d396a1df..00000000 --- a/tests/__data__/expected/guides/us/directv.com.epg.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ 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 deleted file mode 100644 index efb0e0ab..00000000 --- a/tests/__data__/expected/guides/zw/dstv.com.epg.xml +++ /dev/null @@ -1,4 +0,0 @@ - -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 ce60208e..f85848f9 100644 --- a/tests/commands/guides/update.test.js +++ b/tests/commands/guides/update.test.js @@ -21,16 +21,8 @@ it('can generate /guides', () => { { encoding: 'utf8' } ) - const guides = glob - .sync('tests/__data__/expected/guides/**/*.xml') - .map(f => f.replace('tests/__data__/expected/', '')) - - guides.forEach(filepath => { - expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`)) - }) - const compressed = glob - .sync('tests/__data__/expected/guides/**/*.xml.gz') + .sync('tests/__data__/expected/guides/**/*.epg.xml.gz') .map(f => f.replace('tests/__data__/expected/', '')) compressed.forEach(filepath => { @@ -58,12 +50,12 @@ it('will terminate process if programs not found', () => { Generating guides/... Loading \"database/programs.db\"... Loading queue... -Creating \"tests/__data__/output/guides/us/directv.com.epg.xml\"... -Creating \"tests/__data__/output/guides/fr/chaines-tv.orange.fr.epg.xml\"... -Creating \"tests/__data__/output/guides/bh/chaines-tv.orange.fr.epg.xml\"... -Creating \"tests/__data__/output/guides/ge/magticom.ge.epg.xml\"... -Creating \"tests/__data__/output/guides/ru/yandex.ru.epg.xml\"... -Creating \"tests/__data__/output/guides/zw/dstv.com.epg.xml\"... +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 `)