diff --git a/package-lock.json b/package-lock.json index 64adc08d71..9998ee40a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,10 +80,10 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "langs": { + "iso-639-3": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/langs/-/langs-2.0.0.tgz", - "integrity": "sha1-AMMs5IFSpJphRFC5uiYyq1igo2Q=", + "resolved": "https://registry.npmjs.org/iso-639-3/-/iso-639-3-2.0.0.tgz", + "integrity": "sha512-Pp+ctEs/pna6/rj05a5VR3qYxJHBZi95wp20C6Snf/WeghrkR/4G44LPJFqlbyo67XntkcUaxwrGmMeyY+F4mA==", "dev": true }, "markdown-include": { diff --git a/package.json b/package.json index 1e4c9171d9..4e98762ba9 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "escape-string-regexp": "^2.0.0", "fluent-ffmpeg": "^2.1.2", "iptv-playlist-parser": "^0.4.0", - "langs": "^2.0.0", - "markdown-include": "^0.4.3" + "markdown-include": "^0.4.3", + "iso-639-3": "^2.0.0" } } diff --git a/scripts/helper.js b/scripts/helper.js index a0e63c0127..016a32345e 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -5,9 +5,9 @@ const axios = require('axios') const zlib = require('zlib') const epgParser = require('epg-parser') const urlParser = require('url') -const langs = require('langs') const escapeStringRegexp = require('escape-string-regexp') const markdownInclude = require('markdown-include') +const iso6393 = require('iso-639-3') let cache = {} let helper = {} @@ -41,11 +41,15 @@ helper.escapeStringRegexp = function (scring) { } helper.getISO6391Name = function (code) { - return langs.has('3', code) ? langs.where('3', code).name : null + const lang = iso6393.find((l) => l.iso6393 === code.toLowerCase()) + + return lang && lang.name ? lang.name : null } helper.getISO6391Code = function (name) { - return langs.has('name', name) ? langs.where('name', name)['3'] : null + const lang = iso6393.find((l) => l.name === name) + + return lang && lang.iso6393 ? lang.iso6393 : null } helper.parsePlaylist = function (filename) {