feat: enhance seed status retrieval

This commit is contained in:
Hachi-R 2024-12-21 10:15:04 -03:00
parent d7e06d6622
commit 5fbf0baa0f
3 changed files with 21 additions and 2 deletions

View file

@ -42,9 +42,18 @@ def seed_status():
auth_error = validate_rpc_password()
if auth_error:
return auth_error
seed_status = []
for _, downloader in downloads.items():
if not downloader:
continue
status = torrent_downloader.get_seed_status()
return jsonify(status), 200
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():

View file

@ -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,