Working? Lets hope so

This commit is contained in:
mircea32000 2025-02-10 21:05:39 +02:00
parent 5e9aa2b0ea
commit 897e2c3193
7 changed files with 292 additions and 239 deletions

View file

@ -8,8 +8,6 @@ import crypto from "node:crypto";
import { pythonRpcLogger } from "./logger";
import { Readable } from "node:stream";
import { app, dialog } from "electron";
import { db, levelKeys } from "@main/level";
import type { UserPreferences } from "@types";
interface GamePayload {
game_id: string;
@ -44,7 +42,7 @@ export class PythonRPC {
readable.on("data", pythonRpcLogger.log);
}
public static async spawn(
public static spawn(
initialDownload?: GamePayload,
initialSeeding?: GamePayload[]
) {
@ -56,15 +54,6 @@ export class PythonRPC {
initialSeeding ? JSON.stringify(initialSeeding) : "",
];
const userPreferences = await db.get<string, UserPreferences | null>(levelKeys.userPreferences, {
valueEncoding: "json",
});
const env = {
...process.env,
ALLDEBRID_API_KEY: userPreferences?.allDebridApiKey || ""
};
if (app.isPackaged) {
const binaryName = binaryNameByPlatform[process.platform]!;
const binaryPath = path.join(
@ -85,7 +74,6 @@ export class PythonRPC {
const childProcess = cp.spawn(binaryPath, commonArgs, {
windowsHide: true,
stdio: ["inherit", "inherit"],
env
});
this.logStderr(childProcess.stderr);
@ -102,7 +90,6 @@ export class PythonRPC {
const childProcess = cp.spawn("python3", [scriptPath, ...commonArgs], {
stdio: ["inherit", "inherit"],
env
});
this.logStderr(childProcess.stderr);
@ -118,4 +105,4 @@ export class PythonRPC {
this.pythonProcess = null;
}
}
}
}