feat: add ablity to pause and resume the seeding process

This commit is contained in:
Hachi-R
2024-11-08 21:29:40 -03:00
parent c556a00e4a
commit b32952f076
11 changed files with 120 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ import {
LibtorrentStatus,
LibtorrentPayload,
ProcessPayload,
PauseSeedingPayload,
ResumeSeedingPayload,
} from "./types";
import { pythonInstanceLogger as logger } from "../logger";
@@ -133,6 +135,26 @@ export class PythonInstance {
return response.data;
}
static async pauseSeeding(gameId: number) {
await this.rpc
.post("/action", {
action: "pause-seeding",
game_id: gameId,
} as PauseSeedingPayload)
.catch(() => {});
}
static async resumeSeeding(gameId: number, magnet: string, savePath: string) {
await this.rpc
.post("/action", {
action: "resume-seeding",
game_id: gameId,
magnet,
save_path: savePath,
} as ResumeSeedingPayload)
.catch(() => {});
}
static async pauseDownload() {
await this.rpc
.post("/action", {