mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
feat: enhance seed status retrieval
This commit is contained in:
parent
d7e06d6622
commit
5fbf0baa0f
@ -43,8 +43,17 @@ def seed_status():
|
||||
if auth_error:
|
||||
return auth_error
|
||||
|
||||
status = torrent_downloader.get_seed_status()
|
||||
return jsonify(status), 200
|
||||
seed_status = []
|
||||
for _, downloader in downloads.items():
|
||||
if not downloader:
|
||||
continue
|
||||
|
||||
response = downloader.get_download_status()
|
||||
|
||||
if response.get('status') == 5:
|
||||
seed_status.append(response)
|
||||
|
||||
return jsonify(seed_status), 200
|
||||
|
||||
@app.route("/healthcheck", methods=["GET"])
|
||||
def healthcheck():
|
||||
|
@ -139,6 +139,7 @@ class TorrentDownloader:
|
||||
'fileSize': info.total_size() if info else 0,
|
||||
'progress': status.progress,
|
||||
'downloadSpeed': status.download_rate,
|
||||
'uploadSpeed': status.upload_rate,
|
||||
'numPeers': status.num_peers,
|
||||
'numSeeds': status.num_seeds,
|
||||
'status': status.state,
|
||||
|
@ -144,6 +144,15 @@ export class DownloadManager {
|
||||
}
|
||||
|
||||
public static async getSeedStatus() {
|
||||
const seedStatus = await PythonRPC.rpc
|
||||
.get<LibtorrentPayload[] | null>("/seed-status")
|
||||
.then((results) => {
|
||||
if (results === null) return [];
|
||||
return results.data;
|
||||
});
|
||||
|
||||
console.log(seedStatus);
|
||||
|
||||
// const gamesToSeed = await gameRepository.find({
|
||||
// where: { shouldSeed: true, isDeleted: false },
|
||||
// });
|
||||
|
Loading…
Reference in New Issue
Block a user