@hyrious/blivec
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -248,2 +248,7 @@ #!/usr/bin/env node | ||
} | ||
function firstKey(obj) { | ||
for (const key in obj) | ||
return key; | ||
return ""; | ||
} | ||
let selected; | ||
@@ -258,2 +263,5 @@ async function replay(initial = true) { | ||
selected ||= await ask(info); | ||
if (!(selected in info.streams)) { | ||
selected = firstKey(info.streams); | ||
} | ||
} else if (on_close === "ask") { | ||
@@ -272,3 +280,5 @@ selected = await ask(info); | ||
con.pause(); | ||
log.info('to exit, press "Ctrl+C" in the console'); | ||
if (!(on_close === "quit" || on_close === "exit")) { | ||
log.info('to exit, press "Ctrl+C" in the console'); | ||
} | ||
setTimeout(replay, 100, false); | ||
@@ -281,6 +291,9 @@ }); | ||
quit && quit(); | ||
if (process.platform === "win32") { | ||
cp.execSync("taskkill /pid " + child.pid + " /T /F"); | ||
} else { | ||
child.kill(); | ||
try { | ||
if (process.platform === "win32") { | ||
cp.execSync("taskkill /pid " + child.pid + " /T /F", { stdio: "ignore" }); | ||
} else { | ||
child.kill(); | ||
} | ||
} catch { | ||
} | ||
@@ -287,0 +300,0 @@ }; |
{ | ||
"name": "@hyrious/blivec", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "bilibili live cli", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -270,2 +270,7 @@ #!/usr/bin/env node | ||
function firstKey<T extends {}>(obj: T): keyof T { | ||
for (const key in obj) return key; | ||
return "" as any; | ||
} | ||
let selected: string | undefined; | ||
@@ -280,2 +285,7 @@ async function replay(initial = true) { | ||
selected ||= await ask(info); | ||
// It is possible that the selected quality is missing now | ||
// in which case we fallback to the first available one | ||
if (!(selected! in info.streams)) { | ||
selected = firstKey(info.streams); | ||
} | ||
} else if (on_close === "ask") { | ||
@@ -294,3 +304,5 @@ selected = await ask(info); | ||
con.pause(); | ||
log.info('to exit, press "Ctrl+C" in the console'); | ||
if (!(on_close === "quit" || on_close === "exit")) { | ||
log.info('to exit, press "Ctrl+C" in the console'); | ||
} | ||
setTimeout(replay, 100, false); | ||
@@ -305,6 +317,10 @@ }); | ||
quit && quit(); | ||
if (process.platform === "win32") { | ||
cp.execSync("taskkill /pid " + child.pid + " /T /F"); | ||
} else { | ||
child.kill(); | ||
try { | ||
if (process.platform === "win32") { | ||
cp.execSync("taskkill /pid " + child.pid + " /T /F", { stdio: "ignore" }); | ||
} else { | ||
child.kill(); | ||
} | ||
} catch { | ||
// ignore killing error | ||
} | ||
@@ -311,0 +327,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48064
1378