Update helper.js

This commit is contained in:
freearhey 2021-01-27 18:19:40 +03:00
parent ae2aa49e51
commit a41bda5f5e

View File

@ -11,6 +11,38 @@ const iso6393 = require('iso-639-3')
let helper = {}
helper.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'
}
helper.code2flag = function (code) {
switch (code) {
case 'uk':
@ -205,48 +237,7 @@ helper.filterPlaylists = function (arr, include = '', exclude = '') {
}
helper.filterGroup = function (groupTitle) {
if (!groupTitle) return ''
const supportedCategories = [
'Auto',
'Business',
'Classic',
'Comedy',
'Documentary',
'Education',
'Entertainment',
'Family',
'Fashion',
'Food',
'General',
'Health',
'History',
'Hobby',
'Kids',
'Legislative',
'Lifestyle',
'Local',
'Movies',
'Music',
'News',
'Quiz',
'Religious',
'Sci-Fi',
'Shop',
'Sport',
'Travel',
'Weather',
'XXX'
]
const groupIndex = supportedCategories.map(g => g.toLowerCase()).indexOf(groupTitle.toLowerCase())
if (groupIndex === -1) {
groupTitle = ''
} else {
groupTitle = supportedCategories[groupIndex]
}
return groupTitle
return this.supportedCategories[groupTitle.toLowerCase()] || ''
}
helper.sleep = function (ms) {