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() {
|
function main() {
|
||||||
start()
|
start()
|
||||||
|
generateCategoriesTable()
|
||||||
generateCountriesTable()
|
generateCountriesTable()
|
||||||
generateLanguagesTable()
|
generateLanguagesTable()
|
||||||
generateCategoriesTable()
|
|
||||||
generateReadme()
|
generateReadme()
|
||||||
finish()
|
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() {
|
function generateCountriesTable() {
|
||||||
console.log(`Generating countries table...`)
|
console.log(`Generating countries table...`)
|
||||||
const countries = []
|
const countries = []
|
||||||
@ -27,7 +56,7 @@ function generateCountriesTable() {
|
|||||||
|
|
||||||
countries.push({
|
countries.push({
|
||||||
country: 'Undefined',
|
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>`
|
playlist: `<code>https://iptv-org.github.io/iptv/countries/undefined.m3u</code>`
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -42,35 +71,6 @@ function generateCountriesTable() {
|
|||||||
utils.createFile('./.readme/_countries.md', table)
|
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() {
|
function generateLanguagesTable() {
|
||||||
console.log(`Generating languages table...`)
|
console.log(`Generating languages table...`)
|
||||||
const languages = []
|
const languages = []
|
||||||
@ -85,7 +85,7 @@ function generateLanguagesTable() {
|
|||||||
|
|
||||||
languages.push({
|
languages.push({
|
||||||
language: 'Undefined',
|
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>`
|
playlist: `<code>https://iptv-org.github.io/iptv/languages/undefined.m3u</code>`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user