Update clean.js

This commit is contained in:
Aleksandr Statciuk 2021-08-08 14:56:09 +03:00
parent fb25b24686
commit f607b813cb

View File

@ -25,7 +25,6 @@ async function main() {
if (config.debug) log.print(`Debug mode enabled\n`) if (config.debug) log.print(`Debug mode enabled\n`)
log.print(`Parsing 'index.m3u'...`)
let playlists = parser.parseIndex() let playlists = parser.parseIndex()
playlists = utils.filterPlaylists(playlists, config.country, config.exclude) playlists = utils.filterPlaylists(playlists, config.country, config.exclude)
for (const playlist of playlists) { for (const playlist of playlists) {
@ -39,9 +38,11 @@ async function main() {
} }
async function checkPlaylist(playlist) { async function checkPlaylist(playlist) {
if (!config.debug) {
bar = new ProgressBar(`Checking '${playlist.url}': [:bar] :current/:total (:percent) `, { bar = new ProgressBar(`Checking '${playlist.url}': [:bar] :current/:total (:percent) `, {
total: playlist.channels.length total: playlist.channels.length
}) })
}
const channels = [] const channels = []
const total = playlist.channels.length const total = playlist.channels.length
for (const [index, channel] of playlist.channels.entries()) { for (const [index, channel] of playlist.channels.entries()) {
@ -59,10 +60,10 @@ async function checkPlaylist(playlist) {
) { ) {
channels.push(channel) channels.push(channel)
} else { } else {
if (config.debug) bar.interrupt(`ERR: ${channel.url}: ${result.status.reason}`) if (config.debug) log.print(`ERR: ${channel.url}: ${result.status.reason}\n`)
} }
} }
bar.tick() if (!config.debug) bar.tick()
} }
if (playlist.channels.length !== channels.length) { if (playlist.channels.length !== channels.length) {