mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #1196 from iptv-org/return-back-xml-files
Patch 2022.10.2
This commit is contained in:
commit
cc30796270
11 changed files with 40 additions and 22 deletions
|
@ -9,7 +9,7 @@ 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"
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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 }))
|
||||
}
|
||||
|
||||
|
|
|
@ -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.gz</code>`,
|
||||
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</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>`
|
||||
})
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ To load a program guide, all you need to do is copy the link to one or more of t
|
|||
<tr><th>Country </th><th>Channels</th><th>EPG</th><th>Status </th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td valign="top" rowspan="2">🇨🇦 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>
|
||||
<tr><td valign="top" rowspan="2">🇨🇦 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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?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>
|
|
@ -0,0 +1,5 @@
|
|||
<?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>
|
3
tests/__data__/expected/guides/ge/magticom.ge.epg.xml
Normal file
3
tests/__data__/expected/guides/ge/magticom.ge.epg.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?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>
|
2
tests/__data__/expected/guides/ru/yandex.ru.epg.xml
Normal file
2
tests/__data__/expected/guides/ru/yandex.ru.epg.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
|
||||
</tv>
|
2
tests/__data__/expected/guides/us/directv.com.epg.xml
Normal file
2
tests/__data__/expected/guides/us/directv.com.epg.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?><tv date="20220505">
|
||||
</tv>
|
4
tests/__data__/expected/guides/zw/dstv.com.epg.xml
Normal file
4
tests/__data__/expected/guides/zw/dstv.com.epg.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?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>
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue