From c314c397a5102f18e32ee5867d2d76c8379f19b1 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Sat, 9 Nov 2024 01:29:06 -0300 Subject: [PATCH] feat: add option to disable seeding after download completes --- src/main/services/download/download-manager.ts | 5 +---- src/main/services/download/python-instance.ts | 2 ++ .../src/pages/settings/settings-behavior.tsx | 12 ++++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/services/download/download-manager.ts b/src/main/services/download/download-manager.ts index b14e81d7..d56544cc 100644 --- a/src/main/services/download/download-manager.ts +++ b/src/main/services/download/download-manager.ts @@ -2,10 +2,7 @@ import { Game } from "@main/entity"; import { Downloader } from "@shared"; import { PythonInstance } from "./python-instance"; import { WindowManager } from "../window-manager"; -import { - downloadQueueRepository, - gameRepository, -} from "@main/repository"; +import { downloadQueueRepository, gameRepository } from "@main/repository"; import { publishDownloadCompleteNotification } from "../notifications"; import { RealDebridDownloader } from "./real-debrid-downloader"; import type { DownloadProgress } from "@types"; diff --git a/src/main/services/download/python-instance.ts b/src/main/services/download/python-instance.ts index 737d5496..69b4472d 100644 --- a/src/main/services/download/python-instance.ts +++ b/src/main/services/download/python-instance.ts @@ -121,6 +121,8 @@ export class PythonInstance { { id: gameId }, { status: "complete", shouldSeed: false } ); + + this.pauseSeeding(gameId); } this.downloadingGameId = -1; diff --git a/src/renderer/src/pages/settings/settings-behavior.tsx b/src/renderer/src/pages/settings/settings-behavior.tsx index b4b91dd2..c42f68f8 100644 --- a/src/renderer/src/pages/settings/settings-behavior.tsx +++ b/src/renderer/src/pages/settings/settings-behavior.tsx @@ -19,6 +19,7 @@ export function SettingsBehavior() { runAtStartup: false, startMinimized: false, disableNsfwAlert: false, + seedAfterDownloadComplete: false, }); const { t } = useTranslation("settings"); @@ -30,6 +31,7 @@ export function SettingsBehavior() { runAtStartup: userPreferences.runAtStartup, startMinimized: userPreferences.startMinimized, disableNsfwAlert: userPreferences.disableNsfwAlert, + seedAfterDownloadComplete: userPreferences.seedAfterDownloadComplete, }); } }, [userPreferences]); @@ -96,6 +98,16 @@ export function SettingsBehavior() { handleChange({ disableNsfwAlert: !form.disableNsfwAlert }) } /> + + + handleChange({ + seedAfterDownloadComplete: !form.seedAfterDownloadComplete, + }) + } + /> ); }