mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-12 10:00:08 -04:00
Merge pull request #460 from iptv-org/update-update-api.js
Update updat-api.js
This commit is contained in:
commit
217144cf91
14 changed files with 94 additions and 1278 deletions
File diff suppressed because it is too large
Load diff
|
@ -132,7 +132,7 @@ const App = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const guides = await fetch('https://iptv-org.github.io/epg/api/channels.json')
|
const guides = await fetch('api/guides.json')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.catch(console.log)
|
.catch(console.log)
|
||||||
|
|
||||||
|
@ -140,13 +140,13 @@ const App = {
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(arr =>
|
.then(arr =>
|
||||||
arr.map(c => {
|
arr.map(c => {
|
||||||
const found = guides.find(g => g.id === c.id)
|
const found = guides.filter(g => g.channel === c.id)
|
||||||
c.key = `${c.id}_${c.name}`.replace(/\s/g, '').toLowerCase()
|
c.key = `${c.id}_${c.name}`.replace(/\s/g, '').toLowerCase()
|
||||||
c.guides = found ? found.guides : []
|
c.guides = found.map(f => f.url) || []
|
||||||
return c
|
return c
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then(arr => groupBy(arr, 'country'))
|
.then(arr => _.groupBy(arr, 'country'))
|
||||||
.catch(console.log)
|
.catch(console.log)
|
||||||
|
|
||||||
const countries = await fetch('https://iptv-org.github.io/api/countries.json')
|
const countries = await fetch('https://iptv-org.github.io/api/countries.json')
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<title>iptv-org/epg</title>
|
<title>iptv-org/epg</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css" />
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css" />
|
||||||
<script src="https://unpkg.com/vue@next"></script>
|
<script src="https://unpkg.com/vue@next"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/lodash.groupby@4.6.0/index.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="background-color: #f6f8fa; min-height: 100vh">
|
<body style="background-color: #f6f8fa; min-height: 100vh">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
|
4
.github/workflows/auto-update.yml
vendored
4
.github/workflows/auto-update.yml
vendored
|
@ -90,8 +90,8 @@ jobs:
|
||||||
path: scripts/logs/errors.log
|
path: scripts/logs/errors.log
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: channels.json
|
name: guides.json
|
||||||
path: .gh-pages/api/channels.json
|
path: .gh-pages/api/guides.json
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: programs.json
|
name: programs.json
|
||||||
|
|
|
@ -21,64 +21,9 @@ To load a program guide, all you need to do is copy the link to one or more of t
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
#include "./.readme/_ca-provinces.md"
|
#include "./.readme/_ca-provinces.md"
|
||||||
|
|
||||||
## List of supported channels
|
|
||||||
|
|
||||||
https://iptv-org.github.io/epg/index.html
|
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
### List of channels
|
The API documentation can be found in the [iptv-org/api](https://github.com/iptv-org/api) repository.
|
||||||
|
|
||||||
```
|
|
||||||
https://iptv-org.github.io/epg/api/channels.json
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
...
|
|
||||||
{
|
|
||||||
"id": "CNNUSA.us",
|
|
||||||
"name": [
|
|
||||||
"CNN USA"
|
|
||||||
],
|
|
||||||
"logo": "https://cdn.tvpassport.com/image/station/100x100/cnn.png",
|
|
||||||
"country": "US",
|
|
||||||
"guides": [
|
|
||||||
"https://iptv-org.github.io/epg/guides/tvtv.us.guide.xml",
|
|
||||||
...
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
<!-- ### List of programs
|
|
||||||
|
|
||||||
```
|
|
||||||
https://iptv-org.github.io/epg/api/programs.json
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
...
|
|
||||||
{
|
|
||||||
"channel": "CNNUSA.us",
|
|
||||||
"site": "example.com",
|
|
||||||
"lang": "en",
|
|
||||||
"title": "Erin Burnett OutFront",
|
|
||||||
"desc": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
|
|
||||||
"categories": [
|
|
||||||
"Series",
|
|
||||||
"News"
|
|
||||||
],
|
|
||||||
"image": "https://example.com/banner.jpg",
|
|
||||||
"start": 1641772800,
|
|
||||||
"stop": 1641776400
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
``` -->
|
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
|
|
@ -5,45 +5,35 @@ const DB_DIR = process.env.DB_DIR || 'scripts/database'
|
||||||
const API_DIR = process.env.API_DIR || '.gh-pages/api'
|
const API_DIR = process.env.API_DIR || '.gh-pages/api'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await saveToChannelsJson(await loadChannels())
|
await saveToGuidesJson(await loadGuides())
|
||||||
await saveToProgramsJson(await loadPrograms())
|
await saveToProgramsJson(await loadPrograms())
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
async function loadChannels() {
|
async function loadGuides() {
|
||||||
logger.info('Loading channels from database...')
|
logger.info('Loading guides from database...')
|
||||||
|
|
||||||
await db.channels.load()
|
await db.channels.load()
|
||||||
|
|
||||||
const channels = await db.channels.find({}).sort({ xmltv_id: 1 })
|
const channels = await db.channels.find({}).sort({ xmltv_id: 1 })
|
||||||
|
|
||||||
const output = {}
|
const output = []
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
if (!output[channel.xmltv_id]) {
|
|
||||||
output[channel.xmltv_id] = {
|
|
||||||
id: channel.xmltv_id,
|
|
||||||
name: [],
|
|
||||||
logo: channel.logo || null,
|
|
||||||
country: channel.country,
|
|
||||||
guides: []
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
output[channel.xmltv_id].logo = output[channel.xmltv_id].logo || channel.logo
|
|
||||||
}
|
|
||||||
|
|
||||||
output[channel.xmltv_id].name.push(channel.name)
|
|
||||||
output[channel.xmltv_id].name = _.uniq(output[channel.xmltv_id].name)
|
|
||||||
channel.groups.forEach(group => {
|
channel.groups.forEach(group => {
|
||||||
if (channel.programCount) {
|
if (channel.programCount) {
|
||||||
output[channel.xmltv_id].guides.push(
|
output.push({
|
||||||
`https://iptv-org.github.io/epg/guides/${group}.epg.xml`
|
channel: channel.xmltv_id,
|
||||||
)
|
display_name: channel.name,
|
||||||
|
site: channel.site,
|
||||||
|
lang: channel.lang,
|
||||||
|
url: `https://iptv-org.github.io/epg/guides/${group}.epg.xml`
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.values(output)
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadPrograms() {
|
async function loadPrograms() {
|
||||||
|
@ -76,10 +66,10 @@ async function loadPrograms() {
|
||||||
return programs
|
return programs
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveToChannelsJson(channels = []) {
|
async function saveToGuidesJson(guides = []) {
|
||||||
const channelsPath = `${API_DIR}/channels.json`
|
const channelsPath = `${API_DIR}/guides.json`
|
||||||
logger.info(`Saving to "${channelsPath}"...`)
|
logger.info(`Saving to "${channelsPath}"...`)
|
||||||
await file.create(channelsPath, JSON.stringify(channels))
|
await file.create(channelsPath, JSON.stringify(guides))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveToProgramsJson(programs = []) {
|
async function saveToProgramsJson(programs = []) {
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
[{"id":"BravoEast.us","name":["Bravo East"],"logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","country":"US","guides":[]},{"id":"CNNInternationalEurope.us","name":["CNN International Europe","CNN Int"],"logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","country":"US","guides":["https://iptv-org.github.io/epg/guides/fr/chaines-tv.orange.fr.epg.xml"]},{"id":"MNetMovies2.za","name":["M-Net Movies 2"],"logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","country":"ZA","guides":["https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"]}]
|
|
1
tests/__data__/expected/api/guides.json
Normal file
1
tests/__data__/expected/api/guides.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[{"channel":"CNNInternationalEurope.us","display_name":"CNN International Europe","site":"chaines-tv.orange.fr","lang":"fr","url":"https://iptv-org.github.io/epg/guides/fr/chaines-tv.orange.fr.epg.xml"},{"channel":"CNNInternationalEurope.us","display_name":"CNN International Europe","site":"chaines-tv.orange.fr","lang":"fr","url":"https://iptv-org.github.io/epg/guides/bh/chaines-tv.orange.fr.epg.xml"},{"channel":"MNetMovies2.za","display_name":"M-Net Movies 2","site":"dstv.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"}]
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?><tv>
|
||||||
|
<channel id="CNNInternationalEurope.us"><display-name>CNN International Europe</display-name><url>https://chaines-tv.orange.fr</url></channel>
|
||||||
|
<programme start="20220110000000 +0000" stop="20220110010000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">CNN Newsroom Sunday</title><desc lang="ru">Свежая мировая информационная сводка от CNN. О политике, экономике, общественной жизни, культуре, спорте.</desc><category lang="ru">Category1</category><category lang="ru">Category2</category></programme>
|
||||||
|
<programme start="20220110010000 +0000" stop="20220110020000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Fareed Zakaria GPS</title><desc lang="ru">Интервью с главными игроками мировой политики.</desc><category lang="ru">Category1</category></programme>
|
||||||
|
<programme start="20220110020000 +0000" stop="20220110023000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">African Voices Changemakers. 114-я серия</title><desc lang="ru">114-я серия. Африка сегодня - люди, новости, события.</desc></programme>
|
||||||
|
<programme start="20220110023000 +0000" stop="20220110024500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Marketplace Africa. 549-я серия</title><desc lang="ru">549-я серия. Информационная передача об экономических событиях африканского региона. Анализируются проблемы, даются экономические прогнозы.</desc></programme>
|
||||||
|
<programme start="20220110024500 +0000" stop="20220110030000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Marketplace Africa. 548-я серия</title><desc lang="ru">548-я серия. Информационная передача об экономических событиях африканского региона. Анализируются проблемы, даются экономические прогнозы.</desc></programme>
|
||||||
|
<programme start="20220110030000 +0000" stop="20220110033000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">TBD</title><desc lang="ru">Информационно-познавательный проект CNN.</desc></programme>
|
||||||
|
<programme start="20220110033000 +0000" stop="20220110040000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Inside Africa. 586-я серия</title><desc lang="ru">586-я серия. Своеобразное "путешествие" по Африке - почувствуйте все разнообразие культур различных стран и регионов континента.</desc></programme>
|
||||||
|
<programme start="20220110040000 +0000" stop="20220110044500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">CNN Newsroom with Michael Holmes</title><desc lang="ru">Обзор самых важных и актуальных новостей и событий из жизни страны и мира.</desc></programme>
|
||||||
|
<programme start="20220110044500 +0000" stop="20220110050000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">World Sport</title><desc lang="ru">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
|
||||||
|
<programme start="20220110050000 +0000" stop="20220110060000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">CNN Newsroom with Michael Holmes</title><desc lang="ru">Обзор самых важных и актуальных новостей и событий из жизни страны и мира.</desc></programme>
|
||||||
|
<programme start="20220110060000 +0000" stop="20220110064500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">CNN Newsroom with Robyn Curnow</title><desc lang="ru">Обзор самых важных и актуальных новостей и событий из жизни страны и мира.</desc></programme>
|
||||||
|
<programme start="20220110064500 +0000" stop="20220110070000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">World Sport</title><desc lang="ru">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
|
||||||
|
<programme start="20220110070000 +0000" stop="20220110090000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">CNN Newsroom with Rosemary Church</title><desc lang="ru">Свежая мировая информационная сводка от CNN. О политике, экономике, общественной жизни, культуре, спорте.</desc></programme>
|
||||||
|
<programme start="20220110090000 +0000" stop="20220110100000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Early Start</title><desc lang="ru">Новости дня с Кристиной Романс и Дейвом Бриггсом.</desc></programme>
|
||||||
|
<programme start="20220110100000 +0000" stop="20220110123000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">New Day</title><desc lang="ru">Свежий обзор событий в стране и мире.</desc></programme>
|
||||||
|
<programme start="20220110123000 +0000" stop="20220110130000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">World Sport</title><desc lang="ru">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
|
||||||
|
<programme start="20220110130000 +0000" stop="20220110140000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">First Move with Julia Chatterley</title><desc lang="ru">Несколько больших историй, связанных с открытием рынков в США.</desc></programme>
|
||||||
|
<programme start="20220110140000 +0000" stop="20220110144500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Connect the World</title><desc lang="ru">Актуальная мировая информация с разных континентов.</desc></programme>
|
||||||
|
<programme start="20220110144500 +0000" stop="20220110150000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">World Sport</title><desc lang="ru">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
|
||||||
|
<programme start="20220110150000 +0000" stop="20220110160000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Connect the World</title><desc lang="ru">Актуальная мировая информация с разных континентов.</desc></programme>
|
||||||
|
<programme start="20220110160000 +0000" stop="20220110164500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">One World with Zain Asher</title><desc lang="ru">Освещаются важные новости с каждого континента, от политики и текущих дел до социальных вопросов и многого другого.</desc></programme>
|
||||||
|
<programme start="20220110164500 +0000" stop="20220110170000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Marketplace Africa. 549-я серия</title><desc lang="ru">549-я серия. Информационная передача об экономических событиях африканского региона. Анализируются проблемы, даются экономические прогнозы.</desc></programme>
|
||||||
|
<programme start="20220110170000 +0000" stop="20220110180000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Amanpour</title><desc lang="ru">Сводка новостей от знаменитой ведущей канала CNN.</desc></programme>
|
||||||
|
<programme start="20220110180000 +0000" stop="20220110190000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Hala Gorani Tonight</title><desc lang="ru">Используя свой 25-летний журналистский опыт, Хала Горани будет освещать ключевые события в картине дня посредством диалога с гостями и экспертами-аналитиками.</desc></programme>
|
||||||
|
<programme start="20220110190000 +0000" stop="20220110194500 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Quest Means Business</title><desc lang="ru">Ричард Квест возглавляет группу экспертов и корреспондентов, чтобы предоставить актуальные факты, цифры и анализ из делового мира.</desc></programme>
|
||||||
|
<programme start="20220110194500 +0000" stop="20220110200000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Connecting Africa. 114-я серия</title><desc lang="ru">114-я серия. Проект, рассказывающий о людях и компаниях, которые совершают революцию в африканском бизнесе, и о тех, кто объединяет континент, выступая за свободную торговлю в Африке.</desc></programme>
|
||||||
|
<programme start="20220110200000 +0000" stop="20220110210000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">The Lead with Jake Tapper</title><desc lang="ru">Оперативная сводка новостей страны и мира.</desc></programme>
|
||||||
|
<programme start="20220110210000 +0000" stop="20220110213000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">The Global Brief with Bianca Nobilo</title><desc lang="ru">Global Brief с Бьянкой Нобило проницательно исследует меняющийся мир для меняющейся аудитории, обеспечивая непревзойденную глубину и качество для занятых зрителей в быстро меняющемся мире.</desc></programme>
|
||||||
|
<programme start="20220110213000 +0000" stop="20220110220000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">World Sport</title><desc lang="ru">Все о главных спортивных событиях мира. Обзоры самых важных спортивных событий, аналитика, мнения экспертов.</desc></programme>
|
||||||
|
<programme start="20220110220000 +0000" stop="20220110230000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">The Situation Room with Wolf Blitzer</title><desc lang="ru">Командный центр новостей, политики и неординарных репортажей со всего мира.</desc></programme>
|
||||||
|
<programme start="20220110230000 +0000" stop="20220111000000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Erin Burnett OutFront</title><desc lang="ru">Обсуждение самых важных мировых тем в эфире канала CNN.</desc></programme>
|
||||||
|
<programme start="20220111000000 +0000" stop="20220111010000 +0000" channel="CNNInternationalEurope.us"><title lang="ru">Anderson Cooper 360</title><desc lang="ru">Уникальный взгляд Андерсона Купера на главные события мира.</desc></programme>
|
||||||
|
</tv>
|
|
@ -1,2 +1,3 @@
|
||||||
{"group":"fr/chaines-tv.orange.fr","count":1}
|
{"group":"fr/chaines-tv.orange.fr","count":1}
|
||||||
|
{"group":"bh/chaines-tv.orange.fr","count":1}
|
||||||
{"group":"zw/dstv.com","count":1}
|
{"group":"zw/dstv.com","count":1}
|
||||||
|
|
|
@ -46,64 +46,9 @@ To load a program guide, all you need to do is copy the link to one or more of t
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
## List of supported channels
|
|
||||||
|
|
||||||
https://iptv-org.github.io/epg/index.html
|
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
### List of channels
|
The API documentation can be found in the [iptv-org/api](https://github.com/iptv-org/api) repository.
|
||||||
|
|
||||||
```
|
|
||||||
https://iptv-org.github.io/epg/api/channels.json
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
...
|
|
||||||
{
|
|
||||||
"id": "CNNUSA.us",
|
|
||||||
"name": [
|
|
||||||
"CNN USA"
|
|
||||||
],
|
|
||||||
"logo": "https://cdn.tvpassport.com/image/station/100x100/cnn.png",
|
|
||||||
"country": "US",
|
|
||||||
"guides": [
|
|
||||||
"https://iptv-org.github.io/epg/guides/tvtv.us.guide.xml",
|
|
||||||
...
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
<!-- ### List of programs
|
|
||||||
|
|
||||||
```
|
|
||||||
https://iptv-org.github.io/epg/api/programs.json
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
...
|
|
||||||
{
|
|
||||||
"channel": "CNNUSA.us",
|
|
||||||
"site": "example.com",
|
|
||||||
"lang": "en",
|
|
||||||
"title": "Erin Burnett OutFront",
|
|
||||||
"desc": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
|
|
||||||
"categories": [
|
|
||||||
"Series",
|
|
||||||
"News"
|
|
||||||
],
|
|
||||||
"image": "https://example.com/banner.jpg",
|
|
||||||
"start": 1641772800,
|
|
||||||
"stop": 1641776400
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
``` -->
|
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","name":"Bravo East","site":"directv.com","channelsPath":"sites/directv.com/directv.com_us.channels.xml","configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"cluster_id":84,"country":"US","programCount":0,"_id":"00AluKCrCnfgrl8W"}
|
{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","name":"Bravo East","site":"directv.com","channelsPath":"sites/directv.com/directv.com_us.channels.xml","configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"cluster_id":84,"country":"US","programCount":0,"_id":"00AluKCrCnfgrl8W"}
|
||||||
{"lang":"fr","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"53","logo":null,"name":"CNN International Europe","site":"chaines-tv.orange.fr","channelsPath":"sites/chaines-tv.orange.fr/chaines-tv.orange.fr_fr.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr"],"cluster_id":1,"programCount":32,"_id":"0Wefq0oMR3feCcuY"}
|
{"lang":"fr","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"53","logo":null,"name":"CNN International Europe","site":"chaines-tv.orange.fr","channelsPath":"sites/chaines-tv.orange.fr/chaines-tv.orange.fr_fr.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr", "bh/chaines-tv.orange.fr"],"cluster_id":1,"programCount":32,"_id":"0Wefq0oMR3feCcuY"}
|
||||||
{"lang":"ru","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"140","logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","name":"CNN Int","site":"magticom.ge","channelsPath":"sites/magticom.ge/magticom.ge_ge.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"cluster_id":1,"programCount":0,"_id":"1XzrxNkSF2AQNBrT"}
|
{"lang":"ru","country":"US","xmltv_id":"CNNInternationalEurope.us","site_id":"140","logo":"https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg","name":"CNN Int","site":"magticom.ge","channelsPath":"sites/magticom.ge/magticom.ge_ge.channels.xml","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"cluster_id":1,"programCount":0,"_id":"1XzrxNkSF2AQNBrT"}
|
||||||
{"lang":"en","country":"ZA","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","name":"M-Net Movies 2","site":"dstv.com","channelsPath":"sites/dstv.com/dstv.com_zw.channels.xml","configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"cluster_id":120,"programCount":14,"_id":"1lnhXpN7g0ER5XwN"}
|
{"lang":"en","country":"ZA","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","name":"M-Net Movies 2","site":"dstv.com","channelsPath":"sites/dstv.com/dstv.com_zw.channels.xml","configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"cluster_id":120,"programCount":14,"_id":"1lnhXpN7g0ER5XwN"}
|
||||||
|
|
|
@ -15,32 +15,34 @@ beforeEach(() => {
|
||||||
it('can create channels database', () => {
|
it('can create channels database', () => {
|
||||||
const output = content('tests/__data__/output/database/channels.db')
|
const output = content('tests/__data__/output/database/channels.db')
|
||||||
|
|
||||||
expect(output).toMatchObject([
|
expect(output).toEqual(
|
||||||
{
|
expect.arrayContaining([
|
||||||
lang: 'ru',
|
expect.objectContaining({
|
||||||
country: 'US',
|
lang: 'ru',
|
||||||
xmltv_id: 'CNNInternationalEurope.us',
|
country: 'US',
|
||||||
site_id: '140',
|
xmltv_id: 'CNNInternationalEurope.us',
|
||||||
name: 'CNN International Europe',
|
site_id: '140',
|
||||||
site: 'example.com',
|
name: 'CNN International Europe',
|
||||||
channelsPath: 'tests/__data__/input/sites/example.com_ca-nl.channels.xml',
|
site: 'example.com',
|
||||||
configPath: 'tests/__data__/input/sites/example.com.config.js',
|
channelsPath: 'tests/__data__/input/sites/example.com_ca-nl.channels.xml',
|
||||||
groups: ['ca-nl/example.com'],
|
configPath: 'tests/__data__/input/sites/example.com.config.js',
|
||||||
cluster_id: 1
|
groups: ['ca-nl/example.com'],
|
||||||
},
|
cluster_id: 1
|
||||||
{
|
}),
|
||||||
lang: 'en',
|
expect.objectContaining({
|
||||||
xmltv_id: 'CNNInternationalEurope2.us',
|
lang: 'en',
|
||||||
site_id: '141',
|
xmltv_id: 'CNNInternationalEurope2.us',
|
||||||
name: 'CNN International Europe 2',
|
site_id: '141',
|
||||||
site: 'example.com',
|
name: 'CNN International Europe 2',
|
||||||
country: 'US',
|
site: 'example.com',
|
||||||
channelsPath: 'tests/__data__/input/sites/example.com_ca-nl.channels.xml',
|
country: 'US',
|
||||||
configPath: 'tests/__data__/input/sites/example.com.config.js',
|
channelsPath: 'tests/__data__/input/sites/example.com_ca-nl.channels.xml',
|
||||||
groups: ['ca-nl/example.com'],
|
configPath: 'tests/__data__/input/sites/example.com.config.js',
|
||||||
cluster_id: 1
|
groups: ['ca-nl/example.com'],
|
||||||
}
|
cluster_id: 1
|
||||||
])
|
})
|
||||||
|
])
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
function content(filepath) {
|
function content(filepath) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ beforeEach(() => {
|
||||||
'tests/__data__/temp/database/programs.db'
|
'tests/__data__/temp/database/programs.db'
|
||||||
)
|
)
|
||||||
|
|
||||||
execSync(
|
const stdout = execSync(
|
||||||
'DB_DIR=tests/__data__/temp/database API_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
'DB_DIR=tests/__data__/temp/database API_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
|
@ -25,9 +25,9 @@ afterEach(() => {
|
||||||
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can generate channels.json', () => {
|
it('can generate guides.json', () => {
|
||||||
const output = content('tests/__data__/output/api/channels.json')
|
const output = content('tests/__data__/output/api/guides.json')
|
||||||
const expected = content('tests/__data__/expected/api/channels.json')
|
const expected = content('tests/__data__/expected/api/guides.json')
|
||||||
|
|
||||||
expect(output).toBe(expected)
|
expect(output).toBe(expected)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue