Update update-readme.js
Fixes "Other, Undefined and Undefined at 0" issue #2744
This commit is contained in:
parent
a5b5b5ff01
commit
7c62d0948b
|
@ -5,13 +5,42 @@ db.load()
|
|||
|
||||
function main() {
|
||||
start()
|
||||
generateCategoriesTable()
|
||||
generateCountriesTable()
|
||||
generateLanguagesTable()
|
||||
generateCategoriesTable()
|
||||
generateReadme()
|
||||
finish()
|
||||
}
|
||||
|
||||
function generateCategoriesTable() {
|
||||
console.log(`Generating categories table...`)
|
||||
const categories = []
|
||||
|
||||
for (const category of db.categories.all()) {
|
||||
categories.push({
|
||||
category: category.name,
|
||||
channels: db.channels.forCategory(category).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/categories/${category.id}.m3u</code>`
|
||||
})
|
||||
}
|
||||
|
||||
categories.push({
|
||||
category: 'Other',
|
||||
channels: db.channels.forCategory({ id: 'other' }).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/categories/other.m3u</code>`
|
||||
})
|
||||
|
||||
const table = utils.generateTable(categories, {
|
||||
columns: [
|
||||
{ name: 'Category', align: 'left' },
|
||||
{ name: 'Channels', align: 'right' },
|
||||
{ name: 'Playlist', align: 'left' }
|
||||
]
|
||||
})
|
||||
|
||||
utils.createFile('./.readme/_categories.md', table)
|
||||
}
|
||||
|
||||
function generateCountriesTable() {
|
||||
console.log(`Generating countries table...`)
|
||||
const countries = []
|
||||
|
@ -27,7 +56,7 @@ function generateCountriesTable() {
|
|||
|
||||
countries.push({
|
||||
country: 'Undefined',
|
||||
channels: db.channels.forCountry({ code: null }).count(),
|
||||
channels: db.channels.forCountry({ code: 'undefined' }).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/countries/undefined.m3u</code>`
|
||||
})
|
||||
|
||||
|
@ -42,35 +71,6 @@ function generateCountriesTable() {
|
|||
utils.createFile('./.readme/_countries.md', table)
|
||||
}
|
||||
|
||||
function generateCategoriesTable() {
|
||||
console.log(`Generating categories table...`)
|
||||
const categories = []
|
||||
|
||||
for (const category of db.categories.all()) {
|
||||
categories.push({
|
||||
category: category.name,
|
||||
channels: db.channels.forCategory(category).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/categories/${category.id}.m3u</code>`
|
||||
})
|
||||
}
|
||||
|
||||
categories.push({
|
||||
category: 'Other',
|
||||
channels: db.channels.forCategory({ id: null }).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/categories/other.m3u</code>`
|
||||
})
|
||||
|
||||
const table = utils.generateTable(categories, {
|
||||
columns: [
|
||||
{ name: 'Category', align: 'left' },
|
||||
{ name: 'Channels', align: 'right' },
|
||||
{ name: 'Playlist', align: 'left' }
|
||||
]
|
||||
})
|
||||
|
||||
utils.createFile('./.readme/_categories.md', table)
|
||||
}
|
||||
|
||||
function generateLanguagesTable() {
|
||||
console.log(`Generating languages table...`)
|
||||
const languages = []
|
||||
|
@ -85,7 +85,7 @@ function generateLanguagesTable() {
|
|||
|
||||
languages.push({
|
||||
language: 'Undefined',
|
||||
channels: db.channels.forLanguage({ code: null }).count(),
|
||||
channels: db.channels.forLanguage({ code: 'undefined' }).count(),
|
||||
playlist: `<code>https://iptv-org.github.io/iptv/languages/undefined.m3u</code>`
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue