parent
044a7cc01c
commit
c7af11ad8a
|
@ -1,7 +1,6 @@
|
||||||
const IPTVChecker = require('iptv-checker')
|
const IPTVChecker = require('iptv-checker')
|
||||||
const normalize = require('normalize-url')
|
const normalize = require('normalize-url')
|
||||||
const { program } = require('commander')
|
const { program } = require('commander')
|
||||||
const ProgressBar = require('progress')
|
|
||||||
const parser = require('./helpers/parser')
|
const parser = require('./helpers/parser')
|
||||||
const utils = require('./helpers/utils')
|
const utils = require('./helpers/utils')
|
||||||
const file = require('./helpers/file')
|
const file = require('./helpers/file')
|
||||||
|
@ -47,14 +46,13 @@ function savePlaylist(playlist) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updatePlaylist(playlist) {
|
async function updatePlaylist(playlist) {
|
||||||
const bar = new ProgressBar(`Processing '${playlist.url}': [:bar] :current/:total (:percent) `, {
|
const total = playlist.channels.length
|
||||||
total: playlist.channels.length
|
log.print(`Processing '${playlist.url}'...\n`)
|
||||||
})
|
|
||||||
|
|
||||||
buffer = {}
|
buffer = {}
|
||||||
origins = {}
|
origins = {}
|
||||||
for (const [i, channel] of playlist.channels.entries()) {
|
for (const [i, channel] of playlist.channels.entries()) {
|
||||||
bar.tick()
|
const curr = i + 1
|
||||||
updateDescription(channel, playlist)
|
updateDescription(channel, playlist)
|
||||||
normalizeUrl(channel)
|
normalizeUrl(channel)
|
||||||
|
|
||||||
|
@ -74,7 +72,6 @@ async function updatePlaylist(playlist) {
|
||||||
} else {
|
} else {
|
||||||
buffer[i] = null
|
buffer[i] = null
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
if (!bar.complete) log.print(`\n`)
|
|
||||||
log.print(` INFO: ${channel.url} (${result.error})\n`)
|
log.print(` INFO: ${channel.url} (${result.error})\n`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +79,6 @@ async function updatePlaylist(playlist) {
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
buffer[i] = null
|
buffer[i] = null
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
if (!bar.complete) log.print(`\n`)
|
|
||||||
log.print(` ERR: ${channel.data.url} (${err.message})\n`)
|
log.print(` ERR: ${channel.data.url} (${err.message})\n`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue