mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +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:
|
if auth_error:
|
||||||
return auth_error
|
return auth_error
|
||||||
|
|
||||||
status = torrent_downloader.get_seed_status()
|
seed_status = []
|
||||||
return jsonify(status), 200
|
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"])
|
@app.route("/healthcheck", methods=["GET"])
|
||||||
def healthcheck():
|
def healthcheck():
|
||||||
|
@ -139,6 +139,7 @@ class TorrentDownloader:
|
|||||||
'fileSize': info.total_size() if info else 0,
|
'fileSize': info.total_size() if info else 0,
|
||||||
'progress': status.progress,
|
'progress': status.progress,
|
||||||
'downloadSpeed': status.download_rate,
|
'downloadSpeed': status.download_rate,
|
||||||
|
'uploadSpeed': status.upload_rate,
|
||||||
'numPeers': status.num_peers,
|
'numPeers': status.num_peers,
|
||||||
'numSeeds': status.num_seeds,
|
'numSeeds': status.num_seeds,
|
||||||
'status': status.state,
|
'status': status.state,
|
||||||
|
@ -144,6 +144,15 @@ export class DownloadManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async getSeedStatus() {
|
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({
|
// const gamesToSeed = await gameRepository.find({
|
||||||
// where: { shouldSeed: true, isDeleted: false },
|
// where: { shouldSeed: true, isDeleted: false },
|
||||||
// });
|
// });
|
||||||
|
Loading…
Reference in New Issue
Block a user