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,

View File

@ -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 },
// });