Added peers and seeders count for bittorent downloads

Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
jaskaranSM 2020-01-13 19:06:02 +05:30 committed by lzzy12
parent 96e623ef57
commit 8cbe2c29e4
2 changed files with 9 additions and 3 deletions

View File

@ -91,6 +91,10 @@ def get_readable_message():
msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> of " \
f"{download.size()}" \
f" at {download.speed()}, ETA: {download.eta()} "
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
if hasattr(download, 'is_torrent'):
msg += f"| P: {download.download().connections} " \
f"| S: {download.download().num_seeders}"
msg += "\n\n"
return msg

View File

@ -1,4 +1,4 @@
from bot import aria2
from bot import aria2,download_dict,download_dict_lock
from bot.helper.ext_utils.bot_utils import *
from .download_helper import DownloadHelper
from bot.helper.mirror_utils.status_utils.aria_download_status import AriaDownloadStatus
@ -26,7 +26,9 @@ class AriaDownloadHelper(DownloadHelper):
if self.gid == gid:
if api.get_download(gid).followed_by_ids:
self.gid = api.get_download(gid).followed_by_ids[0]
with download_dict_lock:
download_dict[self._listener.uid] = AriaDownloadStatus(self.gid, self._listener)
download_dict[self._listener.uid].is_torrent =True
update_all_messages()
LOGGER.info(f'Changed gid from {gid} to {self.gid}')
else: