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)) {