mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 12:01:57 -04:00
Update scripts
This commit is contained in:
@@ -108,7 +108,7 @@ async function runTest(stream: Stream) {
|
||||
stream.statusCode = result.status.code
|
||||
|
||||
if (stream.statusCode === 'OK') return
|
||||
if (errorStatusCodes.includes(stream.statusCode) && !stream.label) {
|
||||
if (errorStatusCodes.includes(stream.statusCode) && !stream.getLabels().length) {
|
||||
errors++
|
||||
} else {
|
||||
warnings++
|
||||
@@ -128,7 +128,7 @@ function drawTable() {
|
||||
{ name: '', alignment: 'center', minLen: 3, maxLen: 3 },
|
||||
{ name: 'tvg-id', alignment: 'left', color: 'green', minLen: 25, maxLen: 25 },
|
||||
{ name: 'url', alignment: 'left', color: 'green', minLen: 100, maxLen: 100 },
|
||||
{ name: 'label', alignment: 'left', color: 'yellow', minLen: 13, maxLen: 13 },
|
||||
{ name: 'labels', alignment: 'left', color: 'yellow', minLen: 13, maxLen: 13 },
|
||||
{ name: 'status', alignment: 'left', minLen: 25, maxLen: 25 }
|
||||
]
|
||||
})
|
||||
@@ -137,14 +137,14 @@ function drawTable() {
|
||||
const tvgId = truncate(stream.getTvgId(), 25)
|
||||
const url = truncate(stream.url, 100)
|
||||
const color = getColor(stream)
|
||||
const label = stream.label || ''
|
||||
const labels = stream.getLabels().join(';')
|
||||
const status = stream.statusCode || 'PENDING'
|
||||
|
||||
const row = {
|
||||
'': index,
|
||||
'tvg-id': chalk[color](tvgId),
|
||||
url: chalk[color](url),
|
||||
label: chalk[color](label),
|
||||
labels: chalk[color](labels),
|
||||
status: chalk[color](status)
|
||||
}
|
||||
table.append(row)
|
||||
@@ -208,14 +208,14 @@ function getColor(stream: Stream): string {
|
||||
if (!stream.statusCode) return 'gray'
|
||||
if (stream.statusCode === 'LOADING...') return 'white'
|
||||
if (stream.statusCode === 'OK') return 'green'
|
||||
if (errorStatusCodes.includes(stream.statusCode) && !stream.label) return 'red'
|
||||
if (errorStatusCodes.includes(stream.statusCode) && !stream.getLabels().length) return 'red'
|
||||
|
||||
return 'yellow'
|
||||
}
|
||||
|
||||
function isBroken(stream: Stream): boolean {
|
||||
if (!stream.statusCode) return false
|
||||
if (stream.label) return false
|
||||
if (stream.getLabels().length) return false
|
||||
if (!errorStatusCodes.includes(stream.statusCode)) return false
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user