mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 12:01:57 -04:00
Merge branch 'master' into patch-2026.09.1
This commit is contained in:
@@ -58,6 +58,7 @@ const rootStorage = new Storage(ROOT_DIR)
|
||||
async function main() {
|
||||
if (await isOffline()) {
|
||||
logger.error(chalk.red('Internet connection is required for the script to work'))
|
||||
process.exitCode = 1
|
||||
return
|
||||
}
|
||||
|
||||
@@ -195,13 +196,10 @@ async function onFinish(error: Error | null | undefined) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
async function isOffline() {
|
||||
return new Promise((resolve, reject) => {
|
||||
dns.lookup('info.cern.ch', err => {
|
||||
if (err) resolve(true)
|
||||
reject(false)
|
||||
})
|
||||
}).catch(() => {})
|
||||
async function isOffline(): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
dns.lookup('info.cern.ch', err => resolve(Boolean(err)))
|
||||
})
|
||||
}
|
||||
|
||||
function getColor(stream: Stream): string {
|
||||
|
||||
@@ -84,7 +84,7 @@ export class Stream extends sdk.Models.Stream {
|
||||
let title = name
|
||||
const [, labels] = title.match(/ \[(.*)\]$/) || [null, '']
|
||||
title = title.replace(new RegExp(` \\[${escapeRegExp(labels)}\\]$`), '')
|
||||
const [, quality] = title.match(/ \(([0-9]+[p|i])\)$/) || [null, '']
|
||||
const [, quality] = title.match(/ \(([0-9]+[pi])\)$/) || [null, '']
|
||||
title = title.replace(new RegExp(` \\(${quality}\\)$`), '')
|
||||
|
||||
return { title, labels: labels.split(';'), quality }
|
||||
|
||||
Reference in New Issue
Block a user