mirror of
https://github.com/iptv-org/iptv
synced 2025-12-16 10:26:48 -05:00
Update test.ts
This commit is contained in:
@@ -17,7 +17,6 @@ const LIVE_UPDATE_MAX_STREAMS = 100
|
|||||||
|
|
||||||
let errors = 0
|
let errors = 0
|
||||||
let warnings = 0
|
let warnings = 0
|
||||||
const results: { [key: string]: string } = {}
|
|
||||||
let interval: string | number | NodeJS.Timeout | undefined
|
let interval: string | number | NodeJS.Timeout | undefined
|
||||||
let streams = new Collection<Stream>()
|
let streams = new Collection<Stream>()
|
||||||
let isLiveUpdateEnabled = true
|
let isLiveUpdateEnabled = true
|
||||||
@@ -99,11 +98,8 @@ async function main() {
|
|||||||
main()
|
main()
|
||||||
|
|
||||||
async function runTest(stream: Stream) {
|
async function runTest(stream: Stream) {
|
||||||
const key = stream.getUniqKey()
|
stream.statusCode = 'LOADING...'
|
||||||
results[key] = chalk.white('LOADING...')
|
|
||||||
|
|
||||||
const result: StreamTesterResult = await tester.test(stream)
|
const result: StreamTesterResult = await tester.test(stream)
|
||||||
|
|
||||||
stream.statusCode = result.status.code
|
stream.statusCode = result.status.code
|
||||||
|
|
||||||
if (stream.statusCode === 'OK') return
|
if (stream.statusCode === 'OK') return
|
||||||
@@ -205,6 +201,7 @@ async function isOffline() {
|
|||||||
|
|
||||||
function getColor(stream: Stream): string {
|
function getColor(stream: Stream): string {
|
||||||
if (!stream.statusCode) return 'gray'
|
if (!stream.statusCode) return 'gray'
|
||||||
|
if (stream.statusCode === 'LOADING...') return 'white'
|
||||||
if (stream.statusCode === 'OK') return 'green'
|
if (stream.statusCode === 'OK') return 'green'
|
||||||
if (errorStatusCodes.includes(stream.statusCode) && !stream.label) return 'red'
|
if (errorStatusCodes.includes(stream.statusCode) && !stream.label) return 'red'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user