mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
fix: bug after pause seed
This commit is contained in:
parent
c9be6b6b92
commit
56217fbcf8
@ -59,11 +59,14 @@ def seed_status():
|
|||||||
return auth_error
|
return auth_error
|
||||||
|
|
||||||
seed_status = []
|
seed_status = []
|
||||||
|
|
||||||
for game_id, downloader in downloads.items():
|
for game_id, downloader in downloads.items():
|
||||||
if not downloader:
|
if not downloader:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
response = downloader.get_download_status()
|
response = downloader.get_download_status()
|
||||||
|
if response is None:
|
||||||
|
continue
|
||||||
|
|
||||||
if response.get('status') == 5:
|
if response.get('status') == 5:
|
||||||
seed_status.append({
|
seed_status.append({
|
||||||
|
@ -158,13 +158,14 @@ export class DownloadManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async getSeedStatus() {
|
public static async getSeedStatus() {
|
||||||
const seedStatus = await PythonRPC.rpc.get<LibtorrentPayload[] | []>(
|
const seedStatus = await PythonRPC.rpc
|
||||||
"/seed-status"
|
.get<LibtorrentPayload[] | []>("/seed-status")
|
||||||
);
|
.then((res) => res.data);
|
||||||
|
|
||||||
if (!seedStatus.data.length) return;
|
console.log(seedStatus);
|
||||||
|
if (!seedStatus.length) return;
|
||||||
|
|
||||||
seedStatus.data.forEach(async (status) => {
|
seedStatus.forEach(async (status) => {
|
||||||
const game = await gameRepository.findOne({
|
const game = await gameRepository.findOne({
|
||||||
where: { id: status.gameId },
|
where: { id: status.gameId },
|
||||||
});
|
});
|
||||||
@ -188,10 +189,7 @@ export class DownloadManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
WindowManager.mainWindow?.webContents.send(
|
WindowManager.mainWindow?.webContents.send("on-seeding-status", seedStatus);
|
||||||
"on-seeding-status",
|
|
||||||
JSON.parse(JSON.stringify(seedStatus.data))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async pauseDownload() {
|
static async pauseDownload() {
|
||||||
|
@ -77,13 +77,12 @@ export function DownloadGroup({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const seedingMap = useMemo(() => {
|
const seedingMap = useMemo(() => {
|
||||||
if (!Array.isArray(seedingStatus) || seedingStatus.length === 0) {
|
|
||||||
return new Map<number, SeedingStatus>();
|
|
||||||
}
|
|
||||||
const map = new Map<number, SeedingStatus>();
|
const map = new Map<number, SeedingStatus>();
|
||||||
|
|
||||||
seedingStatus.forEach((seed) => {
|
seedingStatus.forEach((seed) => {
|
||||||
map.set(seed.gameId, seed);
|
map.set(seed.gameId, seed);
|
||||||
});
|
});
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}, [seedingStatus]);
|
}, [seedingStatus]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user