Moved skipPlaylist() function back

This commit is contained in:
freearhey 2019-09-09 04:02:21 +03:00
parent 0c868ee187
commit 06982fe724
1 changed files with 16 additions and 1 deletions

View File

@ -229,6 +229,20 @@ function validateUrl(channelUrl) {
return blacklist.indexOf(host) === -1
}
function skipPlaylist(filename) {
let testCountry = process.env.npm_config_country
let excludeList = process.env.npm_config_exclude
let excludeCountries = excludeList ? excludeList.split(',') : []
if (testCountry && filename !== 'channels/' + testCountry + '.m3u') return true
for(const countryCode of excludeCountries) {
if (filename === 'channels/' + countryCode + '.m3u') return true
}
return false
}
module.exports = {
parsePlaylist,
sortByTitleAndUrl,
@ -241,5 +255,6 @@ module.exports = {
addToCache,
checkCache,
clearCache,
validateUrl
validateUrl,
skipPlaylist
}