mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: adding real debrid real time tracking
This commit is contained in:
parent
a39082d326
commit
1cc5a5b209
3 changed files with 1530 additions and 807 deletions
|
@ -51,6 +51,10 @@ export class RealDebridDownloader {
|
|||
}
|
||||
);
|
||||
|
||||
if (progress === 1) {
|
||||
await this.pauseDownload();
|
||||
}
|
||||
|
||||
return {
|
||||
numPeers: 0,
|
||||
numSeeds: 0,
|
||||
|
@ -67,13 +71,42 @@ export class RealDebridDownloader {
|
|||
} as DownloadProgress;
|
||||
}
|
||||
|
||||
if (this.realDebridTorrentId && this.downloadingGame) {
|
||||
const torrentInfo = await RealDebridClient.getTorrentInfo(
|
||||
this.realDebridTorrentId
|
||||
);
|
||||
|
||||
const { status } = torrentInfo;
|
||||
|
||||
if (status === "downloaded") {
|
||||
this.startDownload(this.downloadingGame);
|
||||
}
|
||||
|
||||
const progress = torrentInfo.progress / 100;
|
||||
const totalDownloaded = progress * torrentInfo.bytes;
|
||||
|
||||
return {
|
||||
numPeers: 0,
|
||||
numSeeds: torrentInfo.seeders,
|
||||
downloadSpeed: torrentInfo.speed,
|
||||
timeRemaining: calculateETA(
|
||||
torrentInfo.bytes,
|
||||
totalDownloaded,
|
||||
torrentInfo.speed
|
||||
),
|
||||
isDownloadingMetadata: status === "magnet_conversion",
|
||||
} as DownloadProgress;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static async pauseDownload() {
|
||||
HttpDownload.pauseDownload();
|
||||
await HttpDownload.pauseDownload();
|
||||
|
||||
this.realDebridTorrentId = null;
|
||||
this.downloadingGame = null;
|
||||
this.downloads.delete(this.downloadingGame!.id!);
|
||||
}
|
||||
|
||||
static async startDownload(game: Game) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue