Replace iso6391 package with langs

This commit is contained in:
freearhey 2020-04-11 04:51:20 +03:00
parent aefa622447
commit eb2e7b226e
1 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ const axios = require('axios')
const zlib = require('zlib')
const epgParser = require('epg-parser')
const urlParser = require('url')
const ISO6391 = require('iso-639-1')
const langs = require('langs')
const escapeStringRegexp = require('escape-string-regexp')
const markdownInclude = require('markdown-include')
@ -41,11 +41,11 @@ helper.escapeStringRegexp = function (scring) {
}
helper.getISO6391Name = function (code) {
return ISO6391.getName(code)
return langs.has('3', code) ? langs.where('3', code).name : null
}
helper.getISO6391Code = function (name) {
return ISO6391.getCode(name)
return langs.has('name', name) ? langs.where('name', name)['3'] : null
}
helper.parsePlaylist = function (filename) {
@ -287,7 +287,7 @@ class Channel {
}
_filterLanguage(languageName) {
if (ISO6391.getCode(languageName) !== '') {
if (helper.getISO6391Code(languageName)) {
return languageName
}