mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: integrate DownloadManager for active game downloads and streamline RPC handling
This commit is contained in:
parent
e463ee569a
commit
af2b422154
2 changed files with 17 additions and 14 deletions
|
@ -23,6 +23,18 @@ import path from "path";
|
|||
export class DownloadManager {
|
||||
private static downloadingGameId: number | null = null;
|
||||
|
||||
public static startRPC(game: Game) {
|
||||
if (game && game.status === "active") {
|
||||
PythonRPC.spawn({
|
||||
game_id: game.id,
|
||||
url: game.uri!,
|
||||
save_path: game.downloadPath!,
|
||||
});
|
||||
|
||||
this.downloadingGameId = game.id;
|
||||
}
|
||||
}
|
||||
|
||||
private static async getDownloadStatus() {
|
||||
const response = await PythonRPC.rpc.get<LibtorrentPayload | null>(
|
||||
"/status"
|
||||
|
@ -188,7 +200,7 @@ export class DownloadManager {
|
|||
action: "pause",
|
||||
game_id: this.downloadingGameId,
|
||||
} as PauseDownloadPayload)
|
||||
.catch(() => {});
|
||||
.catch(() => { });
|
||||
|
||||
WindowManager.mainWindow?.setProgressBar(-1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue