mirror of
https://github.com/iptv-org/iptv
synced 2026-05-05 09:07:13 -04:00
Added support of tvg-language attribute
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const util = require('./util')
|
||||
const escapeStringRegexp = require('escape-string-regexp')
|
||||
const ISO6391 = require('iso-639-1')
|
||||
|
||||
const debug = false
|
||||
const verbose = false
|
||||
@@ -121,6 +122,15 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
if(!channel.language && c.name.length && c.name[0].lang) {
|
||||
let language = ISO6391.getName(c.name[0].lang)
|
||||
channel.language = language
|
||||
updated = true
|
||||
if(verbose) {
|
||||
console.log(`Added language '${language}' to '${channel.id}'`)
|
||||
}
|
||||
}
|
||||
|
||||
if(!channel.logo && c.icon.length) {
|
||||
const icon = c.icon[0].split('|')[0]
|
||||
channel.logo = icon
|
||||
|
||||
@@ -39,6 +39,7 @@ class Channel {
|
||||
constructor(data) {
|
||||
this.id = data.tvg.id
|
||||
this.name = data.tvg.name
|
||||
this.language = data.tvg.language
|
||||
this.logo = data.tvg.logo
|
||||
this.group = this._getGroup(data.group.title)
|
||||
this.url = data.url
|
||||
@@ -60,7 +61,7 @@ class Channel {
|
||||
}
|
||||
|
||||
toString() {
|
||||
const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-logo="${this.logo}" group-title="${this.group}",${this.title}`
|
||||
const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" group-title="${this.group}",${this.title}`
|
||||
|
||||
return '#EXTINF:' + info + '\n' + this.url + '\n'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user