Update parser.js
This commit is contained in:
parent
13f1a91afb
commit
a61288c310
@ -1,38 +1,6 @@
|
|||||||
const playlistParser = require('iptv-playlist-parser')
|
const playlistParser = require('iptv-playlist-parser')
|
||||||
const epgParser = require('epg-parser')
|
const epgParser = require('epg-parser')
|
||||||
const utils = require('./utils')
|
const utils = require('./utils')
|
||||||
const supportedCategories = {
|
|
||||||
auto: 'Auto',
|
|
||||||
business: 'Business',
|
|
||||||
classic: 'Classic',
|
|
||||||
comedy: 'Comedy',
|
|
||||||
documentary: 'Documentary',
|
|
||||||
education: 'Education',
|
|
||||||
entertainment: 'Entertainment',
|
|
||||||
family: 'Family',
|
|
||||||
fashion: 'Fashion',
|
|
||||||
food: 'Food',
|
|
||||||
general: 'General',
|
|
||||||
health: 'Health',
|
|
||||||
history: 'History',
|
|
||||||
hobby: 'Hobby',
|
|
||||||
kids: 'Kids',
|
|
||||||
legislative: 'Legislative',
|
|
||||||
lifestyle: 'Lifestyle',
|
|
||||||
local: 'Local',
|
|
||||||
movies: 'Movies',
|
|
||||||
music: 'Music',
|
|
||||||
news: 'News',
|
|
||||||
quiz: 'Quiz',
|
|
||||||
religious: 'Religious',
|
|
||||||
'sci-fi': 'Sci-Fi',
|
|
||||||
shop: 'Shop',
|
|
||||||
sport: 'Sport',
|
|
||||||
travel: 'Travel',
|
|
||||||
weather: 'Weather',
|
|
||||||
xxx: 'XXX',
|
|
||||||
other: 'Other'
|
|
||||||
}
|
|
||||||
|
|
||||||
const parser = {}
|
const parser = {}
|
||||||
|
|
||||||
@ -54,16 +22,7 @@ parser.parseCountries = function (string) {
|
|||||||
return string
|
return string
|
||||||
.split(';')
|
.split(';')
|
||||||
.filter(i => i)
|
.filter(i => i)
|
||||||
.map(code => {
|
.map(code => ({ code: code.toLowerCase(), name: utils.code2name(code) }))
|
||||||
code = code ? code.toLowerCase() : ''
|
|
||||||
if (code === 'int') {
|
|
||||||
return { code: 'int', name: 'International' }
|
|
||||||
} else if (code === 'unsorted') {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return { code, name: utils.code2name(code) }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.parseLanguages = function (string) {
|
parser.parseLanguages = function (string) {
|
||||||
@ -82,7 +41,9 @@ parser.parseLanguages = function (string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parser.parseCategory = function (string) {
|
parser.parseCategory = function (string) {
|
||||||
return supportedCategories[string.toLowerCase()] || ''
|
const category = utils.supportedCategories.find(c => c.id === string.toLowerCase())
|
||||||
|
|
||||||
|
return category ? category.name : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.parseTitle = function (title) {
|
parser.parseTitle = function (title) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user