mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 08:43:57 +00:00
feat: add initial seeding logic and separation between seeding from downloading
This commit is contained in:
@@ -62,6 +62,7 @@ export class PythonInstance {
|
||||
|
||||
public static async getStatus() {
|
||||
if (this.downloadingGameId === -1) return null;
|
||||
console.log("getting status");
|
||||
|
||||
const response = await this.rpc.get<LibtorrentPayload | null>("/status");
|
||||
|
||||
@@ -129,7 +130,7 @@ export class PythonInstance {
|
||||
action: "pause",
|
||||
game_id: this.downloadingGameId,
|
||||
} as PauseDownloadPayload)
|
||||
.catch(() => {});
|
||||
.catch(() => { });
|
||||
|
||||
this.downloadingGameId = -1;
|
||||
}
|
||||
@@ -161,7 +162,7 @@ export class PythonInstance {
|
||||
action: "cancel",
|
||||
game_id: gameId,
|
||||
} as CancelDownloadPayload)
|
||||
.catch(() => {});
|
||||
.catch(() => { });
|
||||
|
||||
this.downloadingGameId = -1;
|
||||
}
|
||||
@@ -174,6 +175,21 @@ export class PythonInstance {
|
||||
.then((response) => response.data);
|
||||
}
|
||||
|
||||
static async startSeeding(game: Game) {
|
||||
if (!this.pythonProcess) {
|
||||
this.spawn();
|
||||
}
|
||||
|
||||
await this.rpc
|
||||
.post("/action", {
|
||||
action: "start-seeding",
|
||||
game_id: game.id,
|
||||
magnet: game.uri,
|
||||
save_path: game.downloadPath,
|
||||
} as StartDownloadPayload)
|
||||
.catch(() => { });
|
||||
}
|
||||
|
||||
private static async handleRpcError(_error: unknown) {
|
||||
await this.rpc.get("/healthcheck").catch(() => {
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user