Update clean.js

This commit is contained in:
freearhey 2021-05-07 03:19:28 +03:00
parent 0d523b0386
commit 213a5a97b3
1 changed files with 7 additions and 3 deletions

View File

@ -30,8 +30,11 @@ const instance = axios.create({
const ignore = ['Geo-blocked', 'Not 24/7'] const ignore = ['Geo-blocked', 'Not 24/7']
const stats = { broken: 0 }
async function main() { async function main() {
console.info(`\nStarting...\n`) console.info(`\nStarting...`)
console.time('Process completed in')
if (config.debug) { if (config.debug) {
console.info(chalk.yellow(`INFO: Debug mode enabled\n`)) console.info(chalk.yellow(`INFO: Debug mode enabled\n`))
} }
@ -94,6 +97,7 @@ async function checkStatus(playlist) {
//console.error(err) //console.error(err)
if (config.debug) { if (config.debug) {
console.info(` ${counter} ${chalk.red('offline')} ${chalk.white(channel.url)}`) console.info(` ${counter} ${chalk.red('offline')} ${chalk.white(channel.url)}`)
stats.broken++
} }
} else { } else {
results.push(channel) results.push(channel)
@ -119,7 +123,7 @@ async function savePlaylist(playlist) {
return false return false
} else { } else {
utils.createFile(playlist.url, output) utils.createFile(playlist.url, output)
console.info(`Playlist has been updated.`) console.info(`Playlist has been updated. Removed ${stats.broken} broken links.`)
} }
return true return true
@ -130,7 +134,7 @@ async function done() {
} }
function finish() { function finish() {
console.info('Done.') console.timeEnd('Process completed in')
} }
main() main()