Merge pull request #1015 from iptv-org/replace-xml-with-gz

Replace the .xml files with the compressed version
This commit is contained in:
Aleksandr Statciuk 2022-08-25 00:16:32 +03:00 committed by GitHub
commit 92773e4f9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 16 additions and 50 deletions

View file

@ -9,8 +9,6 @@ To load a program guide, all you need to do is copy the link to one or more of t
<!-- prettier-ignore -->
#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.

View file

@ -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) {

View file

@ -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) {

View file

@ -55,7 +55,7 @@ async function generateCountriesTable(items = []) {
flag: country.flag,
name: country.name,
channels: item.count,
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`,
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml.gz</code>`,
status: `<a href="https://github.com/iptv-org/epg/actions/workflows/${item.site}.yml"><img src="https://github.com/iptv-org/epg/actions/workflows/${item.site}.yml/badge.svg" alt="${item.site}" style="max-width: 100%;"></a>`
})
}

View file

@ -12,13 +12,11 @@ To load a program guide, all you need to do is copy the link to one or more of t
<tr><th>Country&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th><th>Channels</th><th>EPG</th><th>Status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th></tr>
</thead>
<tbody>
<tr><td valign="top" rowspan="2">🇨🇦&nbsp;Canada</td><td align="right">2</td><td nowrap><code>https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml</code></td><td><a href="https://github.com/iptv-org/epg/actions/workflows/example.com.yml"><img src="https://github.com/iptv-org/epg/actions/workflows/example.com.yml/badge.svg" alt="example.com" style="max-width: 100%;"></a></td></tr>
<tr><td align="right">1</td><td nowrap><code>https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml</code></td><td><a href="https://github.com/iptv-org/epg/actions/workflows/example.com.yml"><img src="https://github.com/iptv-org/epg/actions/workflows/example.com.yml/badge.svg" alt="example.com" style="max-width: 100%;"></a></td></tr>
<tr><td valign="top" rowspan="2">🇨🇦&nbsp;Canada</td><td align="right">2</td><td nowrap><code>https://iptv-org.github.io/epg/guides/ca-en/example.com.epg.xml.gz</code></td><td><a href="https://github.com/iptv-org/epg/actions/workflows/example.com.yml"><img src="https://github.com/iptv-org/epg/actions/workflows/example.com.yml/badge.svg" alt="example.com" style="max-width: 100%;"></a></td></tr>
<tr><td align="right">1</td><td nowrap><code>https://iptv-org.github.io/epg/guides/ca-ru/example.com.epg.xml.gz</code></td><td><a href="https://github.com/iptv-org/epg/actions/workflows/example.com.yml"><img src="https://github.com/iptv-org/epg/actions/workflows/example.com.yml/badge.svg" alt="example.com" style="max-width: 100%;"></a></td></tr>
</tbody>
</table>
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.

View file

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

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
<channel id="CNNInternationalEurope.us"><display-name>CNN International</display-name><icon src="https://i.imgur.com/2BXCg0x.jpg"/><url>https://chaines-tv.orange.fr</url></channel>
<programme start="20220110144500 +0000" stop="20220110150000 +0000" channel="CNNInternationalEurope.us"><title lang="fr">World Sport</title><desc lang="fr">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
<programme start="20220110194500 +0000" stop="20220110200000 +0000" channel="CNNInternationalEurope.us"><title lang="fr">Connecting Africa. 114-я серия</title><desc lang="fr">114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке.</desc></programme>
</tv>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
<channel id="CNNInternationalEurope.us"><display-name>CNN International</display-name><icon src="https://i.imgur.com/2BXCg0x.jpg"/><url>https://chaines-tv.orange.fr</url></channel>
<programme start="20220110144500 +0000" stop="20220110150000 +0000" channel="CNNInternationalEurope.us"><title lang="fr">World Sport</title><desc lang="fr">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
<programme start="20220110194500 +0000" stop="20220110200000 +0000" channel="CNNInternationalEurope.us"><title lang="fr">Connecting Africa. 114-я серия</title><desc lang="fr">114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке.</desc></programme>
</tv>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
<channel id="CNNInternationalEurope.us"><display-name>CNN International</display-name><icon src="https://i.imgur.com/2BXCg0x.jpg"/><url>https://magticom.ge</url></channel>
</tv>

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
</tv>

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
</tv>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
<channel id="MNetMovies2.za"><display-name>M-Net Movies 2</display-name><icon src="https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png"/><url>https://dstv.com</url></channel>
<programme start="20220110134500 +0000" stop="20220110154000 +0000" channel="MNetMovies2.za"><title lang="en">Robin Hood</title><episode-num system="xmltv_ns">8.256.0/1</episode-num><episode-num system="onscreen">S09E257</episode-num></programme>
</tv>

View file

@ -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
`)