mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 10:30:03 -04:00
Capability to test only a specific country code via TEST_COUNTRY=xx enviroment variable
This commit is contained in:
parent
ea9ae06191
commit
c9e0d95fd9
2 changed files with 14 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
error.log
|
error.log
|
||||||
|
*~
|
||||||
|
|
|
@ -22,6 +22,14 @@ function writeToLog(test, country, msg, url) {
|
||||||
console.log(line)
|
console.log(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function skipPlaylist(filename) {
|
||||||
|
let test_country = process.env.TEST_COUNTRY
|
||||||
|
if (test_country && filename !== 'channels/' + test_country + '.m3u') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function loadPlaylist(filename) {
|
function loadPlaylist(filename) {
|
||||||
return M3U.parse(fs.readFileSync(path.resolve(__dirname) + "/../" + filename, { encoding: "utf8" }))
|
return M3U.parse(fs.readFileSync(path.resolve(__dirname) + "/../" + filename, { encoding: "utf8" }))
|
||||||
}
|
}
|
||||||
|
@ -35,6 +43,10 @@ async function testAllLinksIsWorking() {
|
||||||
|
|
||||||
for(let country of countries) {
|
for(let country of countries) {
|
||||||
|
|
||||||
|
if (skipPlaylist(country.file)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const playlist = loadPlaylist(country.file)
|
const playlist = loadPlaylist(country.file)
|
||||||
|
|
||||||
for(let channel of playlist) {
|
for(let channel of playlist) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue