Update update-readme.js
This commit is contained in:
parent
d99372e552
commit
732b131e9b
|
@ -1,5 +1,6 @@
|
||||||
const utils = require('./utils')
|
const utils = require('./utils')
|
||||||
const db = require('./db')
|
const db = require('./db')
|
||||||
|
const parser = require('./parser')
|
||||||
|
|
||||||
db.load()
|
db.load()
|
||||||
|
|
||||||
|
@ -14,22 +15,16 @@ function main() {
|
||||||
|
|
||||||
function generateCategoriesTable() {
|
function generateCategoriesTable() {
|
||||||
console.log(`Generating categories table...`)
|
console.log(`Generating categories table...`)
|
||||||
const categories = []
|
|
||||||
|
|
||||||
for (const category of db.categories.all()) {
|
const categories = []
|
||||||
|
for (const category of [...db.categories.all(), { name: 'Other', id: 'other' }]) {
|
||||||
categories.push({
|
categories.push({
|
||||||
category: category.name,
|
category: category.name,
|
||||||
channels: db.channels.forCategory(category).count(),
|
channels: db.channels.forCategory(category).removeDuplicates().count(),
|
||||||
playlist: `<code>https://iptv-org.github.io/iptv/categories/${category.id}.m3u</code>`
|
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, {
|
const table = utils.generateTable(categories, {
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'Category', align: 'left' },
|
{ name: 'Category', align: 'left' },
|
||||||
|
@ -43,23 +38,21 @@ function generateCategoriesTable() {
|
||||||
|
|
||||||
function generateCountriesTable() {
|
function generateCountriesTable() {
|
||||||
console.log(`Generating countries table...`)
|
console.log(`Generating countries table...`)
|
||||||
const countries = []
|
|
||||||
|
|
||||||
for (const country of db.countries.sortBy(['name']).all()) {
|
const countries = []
|
||||||
|
for (const country of [
|
||||||
|
...db.countries.sortBy(['name']).all(),
|
||||||
|
{ name: 'Undefined', code: 'undefined' }
|
||||||
|
]) {
|
||||||
let flag = utils.code2flag(country.code)
|
let flag = utils.code2flag(country.code)
|
||||||
|
const prefix = flag ? `${flag} ` : ''
|
||||||
countries.push({
|
countries.push({
|
||||||
country: flag + ' ' + country.name,
|
country: prefix + country.name,
|
||||||
channels: db.channels.forCountry(country).count(),
|
channels: db.channels.forCountry(country).removeDuplicates().count(),
|
||||||
playlist: `<code>https://iptv-org.github.io/iptv/countries/${country.code}.m3u</code>`
|
playlist: `<code>https://iptv-org.github.io/iptv/countries/${country.code}.m3u</code>`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
countries.push({
|
|
||||||
country: 'Undefined',
|
|
||||||
channels: db.channels.forCountry({ code: 'undefined' }).count(),
|
|
||||||
playlist: `<code>https://iptv-org.github.io/iptv/countries/undefined.m3u</code>`
|
|
||||||
})
|
|
||||||
|
|
||||||
const table = utils.generateTable(countries, {
|
const table = utils.generateTable(countries, {
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'Country', align: 'left' },
|
{ name: 'Country', align: 'left' },
|
||||||
|
@ -75,20 +68,17 @@ function generateLanguagesTable() {
|
||||||
console.log(`Generating languages table...`)
|
console.log(`Generating languages table...`)
|
||||||
const languages = []
|
const languages = []
|
||||||
|
|
||||||
for (const language of db.languages.sortBy(['name']).all()) {
|
for (const language of [
|
||||||
|
...db.languages.sortBy(['name']).all(),
|
||||||
|
{ name: 'Undefined', code: 'undefined' }
|
||||||
|
]) {
|
||||||
languages.push({
|
languages.push({
|
||||||
language: language.name,
|
language: language.name,
|
||||||
channels: db.channels.forLanguage(language).count(),
|
channels: db.channels.forLanguage(language).removeDuplicates().count(),
|
||||||
playlist: `<code>https://iptv-org.github.io/iptv/languages/${language.code}.m3u</code>`
|
playlist: `<code>https://iptv-org.github.io/iptv/languages/${language.code}.m3u</code>`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
languages.push({
|
|
||||||
language: 'Undefined',
|
|
||||||
channels: db.channels.forLanguage({ code: 'undefined' }).count(),
|
|
||||||
playlist: `<code>https://iptv-org.github.io/iptv/languages/undefined.m3u</code>`
|
|
||||||
})
|
|
||||||
|
|
||||||
const table = utils.generateTable(languages, {
|
const table = utils.generateTable(languages, {
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'Language', align: 'left' },
|
{ name: 'Language', align: 'left' },
|
||||||
|
|
Loading…
Reference in New Issue