MCPcopy
hub / github.com/iptv-org/iptv / main

Function main

scripts/commands/playlist/test.ts:58–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56const rootStorage = new Storage(ROOT_DIR)
57
58async function main() {
59 if (await isOffline()) {
60 logger.error(chalk.red('Internet connection is required for the script to work'))
61 return
62 }
63
64 logger.info('loading data from api...')
65 await loadData()
66
67 logger.info('loading streams...')
68 const parser = new PlaylistParser({
69 storage: rootStorage
70 })
71 const files = program.args.length ? program.args : await rootStorage.list(`${STREAMS_DIR}/*.m3u`)
72 streams = await parser.parse(files)
73
74 logger.info(`found ${streams.count()} streams`)
75 if (streams.count() > LIVE_UPDATE_MAX_STREAMS) isLiveUpdateEnabled = false
76
77 logger.info('starting...')
78 if (!isLiveUpdateEnabled) {
79 drawTable()
80 interval = setInterval(() => {
81 drawTable()
82 }, LIVE_UPDATE_INTERVAL)
83 }
84
85 eachLimit(
86 streams.all(),
87 options.parallel,
88 async (stream: Stream) => {
89 await runTest(stream)
90
91 if (isLiveUpdateEnabled) {
92 drawTable()
93 }
94 },
95 onFinish
96 )
97}
98
99main()
100

Callers 1

test.tsFile · 0.70

Calls 7

parseMethod · 0.95
loadDataFunction · 0.90
isOfflineFunction · 0.85
drawTableFunction · 0.85
runTestFunction · 0.85
errorMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected