|
|
@ -11,6 +11,38 @@ const iso6393 = require('iso-639-3')
|
|
|
|
|
|
|
|
|
|
|
|
let helper = {}
|
|
|
|
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) {
|
|
|
|
helper.code2flag = function (code) {
|
|
|
|
switch (code) {
|
|
|
|
switch (code) {
|
|
|
|
case 'uk':
|
|
|
|
case 'uk':
|
|
|
@ -205,48 +237,7 @@ helper.filterPlaylists = function (arr, include = '', exclude = '') {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
helper.filterGroup = function (groupTitle) {
|
|
|
|
helper.filterGroup = function (groupTitle) {
|
|
|
|
if (!groupTitle) return ''
|
|
|
|
return this.supportedCategories[groupTitle.toLowerCase()] || ''
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
helper.sleep = function (ms) {
|
|
|
|
helper.sleep = function (ms) {
|
|
|
|