mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update-codes.js
This commit is contained in:
parent
8829f1043c
commit
6a9d978815
1 changed files with 21 additions and 1 deletions
|
@ -3,6 +3,7 @@ const glob = require('glob')
|
|||
const path = require('path')
|
||||
const convert = require('xml-js')
|
||||
const axios = require('axios')
|
||||
const countries = require('./countries.json')
|
||||
|
||||
async function main() {
|
||||
let codes = {}
|
||||
|
@ -57,7 +58,26 @@ async function main() {
|
|||
if (a.display_name.toLowerCase() > b.display_name.toLowerCase()) return 1
|
||||
return 0
|
||||
})
|
||||
writeToFile('codes.json', convertToJSON(sorted))
|
||||
writeToFile('.gh-pages/codes.json', convertToJSON(sorted))
|
||||
|
||||
const _items = {}
|
||||
countries.forEach(country => {
|
||||
_items[country.code] = {
|
||||
...country,
|
||||
show: false,
|
||||
channels: []
|
||||
}
|
||||
})
|
||||
|
||||
sorted.forEach(channel => {
|
||||
const item = _items[channel.country]
|
||||
if (item) {
|
||||
channel.hash = `${channel.display_name}:${channel.tvg_id}`.toLowerCase()
|
||||
item.channels.push(channel)
|
||||
}
|
||||
})
|
||||
writeToFile('.gh-pages/_items.json', convertToJSON(_items))
|
||||
|
||||
console.log('Done')
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue