Update scripts

This commit is contained in:
freearhey
2026-09-03 14:53:13 +03:00
parent b700995496
commit d4f07c0a4c
7 changed files with 81 additions and 39 deletions
+6 -6
View File
@@ -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