From 06982fe7244290c32282c5216d1c71b2cea7e1cc Mon Sep 17 00:00:00 2001 From: freearhey Date: Mon, 9 Sep 2019 04:02:21 +0300 Subject: [PATCH] Moved skipPlaylist() function back --- helpers/util.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/helpers/util.js b/helpers/util.js index 8187223e8..0180963b3 100644 --- a/helpers/util.js +++ b/helpers/util.js @@ -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 } \ No newline at end of file