Skip to content

Commit

Permalink
catch exception when checking ttv lol plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBrax committed Dec 23, 2024
1 parent d809a28 commit f4a6ce5
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions server/src/Providers/Twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1506,28 +1506,46 @@ export class TwitchHelper {
}

public static async checkTTVLolPlugin() {

const bin = Helper.path_streamlink();

if (!bin) {
throw new Error("Streamlink binary not found");
}

const args = [
"--twitch-proxy-playlist",
];
const args = ["--twitch-proxy-playlist"];

const execReturn = await execSimple(bin, args, "streamlink ttv lol plugin check");
let execReturn;

const log = execReturn.stdout.join("\n") + "\n" + execReturn.stderr.join("\n");
try {
execReturn = await execSimple(
bin,
args,
"streamlink ttv lol plugin check"
);
} catch (error) {
log(
LOGLEVEL.ERROR,
"tw.helper.checkTTVLolPlugin",
`Error checking streamlink ttv lol plugin: ${
(error as Error).message
}`,
error
);

return false;
}

if (log.includes("unrecognized arguments: --twitch-proxy-playlist")) {
const fullLog =
execReturn.stdout.join("\n") + "\n" + execReturn.stderr.join("\n");

if (
fullLog.includes("unrecognized arguments: --twitch-proxy-playlist")
) {
return false;
}

return true;
}

}

/*
Expand Down

0 comments on commit f4a6ce5

Please sign in to comment.