From bfc2eeb452466ea00545aef4d7e6e0e7028c8467 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sun, 8 Sep 2019 19:52:49 +0300 Subject: [PATCH] Update index.js - added skipPlaylist() function - added exclude option to script --- test/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 6f79064d8..87bac81f6 100644 --- a/test/index.js +++ b/test/index.js @@ -41,7 +41,7 @@ async function test() { for(let country of countries) { - if (util.skipPlaylist(country.url)) { + if (skipPlaylist(country.url)) { continue } @@ -114,3 +114,16 @@ function writeToLog(country, msg, url) { util.appendToFile(errorLog, now.toISOString() + ' ' + line + '\n') console.log(`Error: ${msg} '${url}'`) } + +function skipPlaylist(filename) { + let testCountry = process.env.npm_config_country + let excludeCountries = process.env.npm_config_exclude.split(',') + + if (testCountry && filename !== 'channels/' + testCountry + '.m3u') return true + + for(const countryCode of excludeCountries) { + if (filename === 'channels/' + countryCode + '.m3u') return true + } + + return false +} \ No newline at end of file