feat: get process list from rpc

This commit is contained in:
Zamitto 2024-07-03 11:23:50 -03:00
parent 0c1a75eedd
commit 75c8f69e81
10 changed files with 57 additions and 49 deletions

View file

@ -1,6 +1,6 @@
import { Game } from "@main/entity";
import { Downloader } from "@shared";
import { TorrentDownloader } from "./torrent-downloader";
import { RPCManager } from "./rpc-manager";
import { WindowManager } from "../window-manager";
import { downloadQueueRepository, gameRepository } from "@main/repository";
import { publishDownloadCompleteNotification } from "../notifications";
@ -16,7 +16,7 @@ export class DownloadManager {
if (this.currentDownloader === Downloader.RealDebrid) {
status = await RealDebridDownloader.getStatus();
} else {
status = await TorrentDownloader.getStatus();
status = await RPCManager.getStatus();
}
if (status) {
@ -65,7 +65,7 @@ export class DownloadManager {
if (this.currentDownloader === Downloader.RealDebrid) {
RealDebridDownloader.pauseDownload();
} else {
await TorrentDownloader.pauseDownload();
await RPCManager.pauseDownload();
}
WindowManager.mainWindow?.setProgressBar(-1);
@ -77,7 +77,7 @@ export class DownloadManager {
RealDebridDownloader.startDownload(game);
this.currentDownloader = Downloader.RealDebrid;
} else {
TorrentDownloader.startDownload(game);
RPCManager.startDownload(game);
this.currentDownloader = Downloader.Torrent;
}
}
@ -86,7 +86,7 @@ export class DownloadManager {
if (this.currentDownloader === Downloader.RealDebrid) {
RealDebridDownloader.cancelDownload();
} else {
TorrentDownloader.cancelDownload(gameId);
RPCManager.cancelDownload(gameId);
}
WindowManager.mainWindow?.setProgressBar(-1);
@ -98,7 +98,7 @@ export class DownloadManager {
RealDebridDownloader.startDownload(game);
this.currentDownloader = Downloader.RealDebrid;
} else {
TorrentDownloader.startDownload(game);
RPCManager.startDownload(game);
this.currentDownloader = Downloader.Torrent;
}
}