chore: use resumeDownload()

This commit is contained in:
Hachi-R
2024-11-05 15:16:10 -03:00
parent 1458314df6
commit 86d3f7ac81
3 changed files with 12 additions and 40 deletions

View File

@@ -62,12 +62,13 @@ 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");
if (response.data === null) return null;
console.log(response.data);
try {
const {
progress,
@@ -105,7 +106,7 @@ export class PythonInstance {
);
}
if (progress === 1 && !isCheckingFiles) {
if (progress === 1 && !isCheckingFiles && status !== LibtorrentStatus.Seeding) {
this.downloadingGameId = -1;
}
@@ -175,21 +176,6 @@ 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(