Merge branch 'feature/seed-completed-downloads' of github.com:hydralauncher/hydra into feature/seed-completed-downloads

This commit is contained in:
Chubby Granny Chaser
2024-11-28 10:34:15 +00:00
12 changed files with 585 additions and 79 deletions

View File

@@ -9,6 +9,8 @@ import type { DownloadProgress } from "@types";
import { GofileApi, QiwiApi } from "../hosters";
import { GenericHttpDownloader } from "./generic-http-downloader";
import { In, Not } from "typeorm";
import path from "path";
import fs from "fs";
export class DownloadManager {
private static currentDownloader: Downloader | null = null;
@@ -85,6 +87,30 @@ export class DownloadManager {
}
const gameIds = seedStatus.map((status) => status.gameId);
for (const gameId of gameIds) {
const game = await gameRepository.findOne({
where: { id: gameId },
});
if (game) {
const isNotDeleted = fs.existsSync(
path.join(game.downloadPath!, game.folderName!)
);
if (!isNotDeleted) {
await this.pauseSeeding(game.id);
await gameRepository.update(game.id, {
status: "complete",
shouldSeed: false,
});
WindowManager.mainWindow?.webContents.send("on-hard-delete");
}
}
}
const updateList = await gameRepository.find({
where: {
id: In(gameIds),