mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update-readme.js
This commit is contained in:
parent
5f9cf5130b
commit
6dba6ea503
1 changed files with 9 additions and 22 deletions
|
@ -18,29 +18,18 @@ async function main() {
|
||||||
data.push({
|
data.push({
|
||||||
countryFlag: country.flag,
|
countryFlag: country.flag,
|
||||||
countryName: country.name,
|
countryName: country.name,
|
||||||
stateName: country.state,
|
|
||||||
guideUrl: filename.replace('.gh-pages', 'https://iptv-org.github.io/epg'),
|
guideUrl: filename.replace('.gh-pages', 'https://iptv-org.github.io/epg'),
|
||||||
channelCount: parsed.channels.length
|
channelCount: parsed.channels.length
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
data = data
|
data = data.sort((a, b) => {
|
||||||
.sort((a, b) => {
|
var countryNameA = a.countryName.toLowerCase()
|
||||||
var countryNameA = a.countryName.toLowerCase()
|
var countryNameB = b.countryName.toLowerCase()
|
||||||
var countryNameB = b.countryName.toLowerCase()
|
if (countryNameA < countryNameB) return -1
|
||||||
var stateNameA = a.stateName.toLowerCase()
|
if (countryNameA > countryNameB) return 1
|
||||||
var stateNameB = b.stateName.toLowerCase()
|
return b.channelCount - a.channelCount
|
||||||
if (countryNameA < countryNameB) return -1
|
})
|
||||||
if (countryNameA > countryNameB) return 1
|
|
||||||
if (stateNameA < stateNameB) return -1
|
|
||||||
if (stateNameA > stateNameB) return 1
|
|
||||||
return b.channelCount - a.channelCount
|
|
||||||
})
|
|
||||||
.map(i => {
|
|
||||||
if (i.stateName) delete i.countryName
|
|
||||||
|
|
||||||
return i
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('Generating table...')
|
console.log('Generating table...')
|
||||||
const table = generateTable(data, ['Country', 'Channels', 'EPG'])
|
const table = generateTable(data, ['Country', 'Channels', 'EPG'])
|
||||||
|
@ -64,12 +53,10 @@ function generateTable(data, header) {
|
||||||
|
|
||||||
output += '\t<tbody>\n'
|
output += '\t<tbody>\n'
|
||||||
for (let item of data) {
|
for (let item of data) {
|
||||||
const size = data.filter(i => i.countryName && i.countryName === item.countryName).length
|
const size = data.filter(i => i.countryName === item.countryName).length
|
||||||
let root = output.indexOf(item.countryName) === -1
|
let root = output.indexOf(item.countryName) === -1
|
||||||
const rowspan = root && size > 1 ? ` rowspan="${size}"` : ''
|
const rowspan = root && size > 1 ? ` rowspan="${size}"` : ''
|
||||||
const name = item.stateName
|
const name = item.countryName
|
||||||
? ` ${item.stateName}`
|
|
||||||
: item.countryName
|
|
||||||
const cell1 = root
|
const cell1 = root
|
||||||
? `<td align="left" valign="top" nowrap${rowspan}>${item.countryFlag} ${name}</td>`
|
? `<td align="left" valign="top" nowrap${rowspan}>${item.countryFlag} ${name}</td>`
|
||||||
: ''
|
: ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue