mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update-api.js
This commit is contained in:
parent
4e28c1a119
commit
8baeed2247
3 changed files with 10 additions and 14 deletions
|
@ -14,19 +14,18 @@ main()
|
||||||
async function loadGuides() {
|
async function loadGuides() {
|
||||||
logger.info('Loading guides from database...')
|
logger.info('Loading guides from database...')
|
||||||
|
|
||||||
await db.channels.load()
|
await db.queue.load()
|
||||||
|
|
||||||
const channels = await db.channels.find({}).sort({ xmltv_id: 1 })
|
const queue = await db.queue.find({}).sort({ xmltv_id: 1 })
|
||||||
|
|
||||||
const output = []
|
const output = []
|
||||||
for (const channel of channels) {
|
for (const item of queue) {
|
||||||
channel.groups.forEach(group => {
|
item.groups.forEach(group => {
|
||||||
if (channel.programCount) {
|
if (item.programCount) {
|
||||||
output.push({
|
output.push({
|
||||||
channel: channel.xmltv_id,
|
channel: item.xmltv_id,
|
||||||
display_name: channel.name,
|
site: item.site,
|
||||||
site: channel.site,
|
lang: item.lang,
|
||||||
lang: channel.lang,
|
|
||||||
url: `https://iptv-org.github.io/epg/guides/${group}.epg.xml`
|
url: `https://iptv-org.github.io/epg/guides/${group}.epg.xml`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +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"}]
|
[{"channel":"CNNInternationalEurope.us","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","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","site":"dstv.com","lang":"en","url":"https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"}]
|
|
@ -6,10 +6,7 @@ beforeEach(() => {
|
||||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||||
fs.mkdirSync('tests/__data__/output')
|
fs.mkdirSync('tests/__data__/output')
|
||||||
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
|
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
|
||||||
fs.copyFileSync(
|
fs.copyFileSync('tests/__data__/input/database/queue.db', 'tests/__data__/temp/database/queue.db')
|
||||||
'tests/__data__/input/database/channels.db',
|
|
||||||
'tests/__data__/temp/database/channels.db'
|
|
||||||
)
|
|
||||||
fs.copyFileSync(
|
fs.copyFileSync(
|
||||||
'tests/__data__/input/database/programs.db',
|
'tests/__data__/input/database/programs.db',
|
||||||
'tests/__data__/temp/database/programs.db'
|
'tests/__data__/temp/database/programs.db'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue