Added support of tvg-language attribute

This commit is contained in:
freearhey 2019-10-30 20:19:54 +03:00
parent fc39bcebce
commit 3f0f9ae066
4 changed files with 29 additions and 11 deletions

View File

@ -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

View File

@ -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'
}

24
package-lock.json generated
View File

@ -4,9 +4,9 @@
"lockfileVersion": 1,
"dependencies": {
"@babel/runtime-corejs2": {
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.6.2.tgz",
"integrity": "sha512-wdyVKnTv9Be4YlwF/7pByYNfcl23qC21aAQ0aIaZOo2ZOvhFEyJdBLJClYZ9i+Pmrz7sUQgg/MwbJa2RZTkygg==",
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.6.3.tgz",
"integrity": "sha512-nuA2o+rgX2+PrNTZ063ehncVcg7sn+tU71BB81SaWRVUbGwCOlb0+yQA1e0QqmzOfRSYOxfvf8cosYqFbJEiwQ==",
"dev": true,
"requires": {
"core-js": "^2.6.5",
@ -30,9 +30,9 @@
}
},
"core-js": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz",
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==",
"version": "2.6.10",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.10.tgz",
"integrity": "sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA==",
"dev": true
},
"debug": {
@ -88,9 +88,9 @@
}
},
"iptv-playlist-parser": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/iptv-playlist-parser/-/iptv-playlist-parser-0.2.2.tgz",
"integrity": "sha512-F0BoyFJNv2NxhAGU/lJnQJ5J6eDktmJdoOi06C4SEuBHv3y61eLNjcbFi/kE9TlAo8Lry4t4U0Io+MOQX3mXHw==",
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/iptv-playlist-parser/-/iptv-playlist-parser-0.3.0.tgz",
"integrity": "sha512-FA9B+8Lh+0KtWWXDaxzFf1DY3QJI+mGCZP/E51XoJcfahnajyyqdfI1ClpQquFHok2CLNqnfbeW6rzJN9TCREg==",
"dev": true,
"requires": {
"decamelize": "^3.2.0",
@ -109,6 +109,12 @@
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
"iso-639-1": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-2.1.0.tgz",
"integrity": "sha512-8CTinLimb9ncAJ11wpCETWZ51qsQ3LS4vMHF2wxRRtR3+b7bvIxUlXOGYIdq0413+baWnbyG5dBluVcezOG/LQ==",
"dev": true
},
"m3u8-file-parser": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/m3u8-file-parser/-/m3u8-file-parser-0.2.2.tgz",

View File

@ -15,7 +15,8 @@
"epg-parser": "^0.1.1",
"escape-string-regexp": "^2.0.0",
"fluent-ffmpeg": "^2.1.2",
"iptv-playlist-parser": "^0.2.2",
"iptv-playlist-parser": "^0.3.0",
"iso-639-1": "^2.1.0",
"markdown-include": "^0.4.3",
"xmldom": "^0.1.27"
}