mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: implement pause and resume functionality for game seeding in DownloadManager
This commit is contained in:
parent
ea90b49604
commit
843301c8b6
4 changed files with 29 additions and 2 deletions
|
@ -19,6 +19,7 @@ import { calculateETA, getDirSize } from "./helpers";
|
|||
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
|
||||
import { RealDebridClient } from "./real-debrid";
|
||||
import path from "path";
|
||||
import { logger } from "../logger";
|
||||
|
||||
export class DownloadManager {
|
||||
private static downloadingGameId: number | null = null;
|
||||
|
@ -164,6 +165,8 @@ export class DownloadManager {
|
|||
|
||||
if (!seedStatus.length) return;
|
||||
|
||||
logger.log(seedStatus);
|
||||
|
||||
seedStatus.forEach(async (status) => {
|
||||
const game = await gameRepository.findOne({
|
||||
where: { id: status.gameId },
|
||||
|
@ -219,6 +222,22 @@ export class DownloadManager {
|
|||
this.downloadingGameId = null;
|
||||
}
|
||||
|
||||
static async resumeSeeding(game: Game) {
|
||||
await PythonRPC.rpc.post("/action", {
|
||||
action: "resume_seeding",
|
||||
game_id: game.id,
|
||||
url: game.uri,
|
||||
save_path: game.downloadPath,
|
||||
});
|
||||
}
|
||||
|
||||
static async pauseSeeding(gameId: number) {
|
||||
await PythonRPC.rpc.post("/action", {
|
||||
action: "pause_seeding",
|
||||
game_id: gameId,
|
||||
});
|
||||
}
|
||||
|
||||
static async startDownload(game: Game) {
|
||||
switch (game.downloader) {
|
||||
case Downloader.Gofile: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue