From 02b27d247f3c68757d859cdcb946411700e82ffd Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 11 Mar 2022 19:10:49 +0300 Subject: [PATCH] Update cleaner.js --- scripts/commands/playlist/cleaner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/commands/playlist/cleaner.js b/scripts/commands/playlist/cleaner.js index 3433526b35..8595dbf5f2 100644 --- a/scripts/commands/playlist/cleaner.js +++ b/scripts/commands/playlist/cleaner.js @@ -1,13 +1,15 @@ const { file, parser, logger, checker, m3u } = require('../../core') const { program } = require('commander') -const options = program +program .argument('[filepath]', 'Path to file to validate') .option('-t, --timeout ', 'Set timeout for each request', parser.parseNumber, 60000) .option('-d, --delay ', 'Set delay for each request', parser.parseNumber, 0) .option('--debug', 'Enable debug mode') .parse(process.argv) +const options = program.opts() + async function main() { const files = program.args.length ? program.args : await file.list('streams/*.m3u') @@ -17,6 +19,7 @@ async function main() { const playlist = await parser.parsePlaylist(filepath) const before = playlist.items.length for (const stream of playlist.items) { + if (options.debug) logger.info(stream.url) const [_, status] = stream.raw.match(/status="([a-z]+)"/) || [null, null] stream.status = status if (status === 'error' && /^(http|https)/.test(stream.url) && !/\[.*\]$/.test(stream.name)) {