mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: seed after doenload
This commit is contained in:
parent
21ca26dcfe
commit
9c9c0e6c09
@ -158,8 +158,34 @@ class TorrentDownloader:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if status.progress == 1:
|
if status.progress == 1:
|
||||||
torrent_handle.pause()
|
|
||||||
self.session.remove_torrent(torrent_handle)
|
|
||||||
self.downloading_game_id = -1
|
self.downloading_game_id = -1
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def get_seed_status(self):
|
||||||
|
response = []
|
||||||
|
|
||||||
|
for game_id, torrent_handle in self.torrent_handles.items():
|
||||||
|
if game_id == self.downloading_game_id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
status = torrent_handle.status()
|
||||||
|
info = torrent_handle.torrent_file()
|
||||||
|
|
||||||
|
torrent_info = {
|
||||||
|
'folderName': info.name() if info else "",
|
||||||
|
'fileSize': info.total_size() if info else 0,
|
||||||
|
'gameId': game_id,
|
||||||
|
'progress': status.progress,
|
||||||
|
'downloadSpeed': status.download_rate,
|
||||||
|
'uploadSpeed': status.upload_rate,
|
||||||
|
'numPeers': status.num_peers,
|
||||||
|
'numSeeds': status.num_seeds,
|
||||||
|
'status': status.state,
|
||||||
|
'bytesDownloaded': status.progress * info.total_size() if info else status.all_time_download,
|
||||||
|
}
|
||||||
|
|
||||||
|
if status.state == 5:
|
||||||
|
response.append(torrent_info)
|
||||||
|
|
||||||
|
return response
|
||||||
|
Loading…
Reference in New Issue
Block a user