def getDownloadByGid(gid): with download_dict_lock: for dl in download_dict.values(): if dl.status() != MirrorStatus.STATUS_UPLOADING and dl.status( ) != MirrorStatus.STATUS_ARCHIVING: if dl.gid() == gid: return dl return None
def getDownloadByGid(gid): with download_dict_lock: for dl in download_dict.values(): status = dl.status() if status != MirrorStatus.STATUS_ARCHIVING and status != MirrorStatus.STATUS_EXTRACTING: if dl.gid() == gid: return dl return None
def getDownloadByGid(gid): with download_dict_lock: for dl in download_dict.values(): if dl.status() == MirrorStatus.STATUS_DOWNLOADING or dl.status( ) == MirrorStatus.STATUS_WAITING: if dl.gid() == gid: return dl return None
def getAllDownload(): with download_dict_lock: for dlDetails in download_dict.values(): if dlDetails.status( ) == MirrorStatus.STATUS_DOWNLOADING or dlDetails.status( ) == MirrorStatus.STATUS_WAITING: if dlDetails: return dlDetails return None
def getDownloadByGid(gid): with download_dict_lock: for dl in download_dict.values(): status = dl.status() if (status not in [ MirrorStatus.STATUS_ARCHIVING, MirrorStatus.STATUS_EXTRACTING, ] and dl.gid() == gid): return dl return None
def cancel_all(update, context): with download_dict_lock: count = 0 for dlDetails in list(download_dict.values()): if dlDetails.status() == MirrorStatus.STATUS_DOWNLOADING \ or dlDetails.status() == MirrorStatus.STATUS_WAITING: dlDetails.download().cancel_download() count += 1 delete_all_messages() sendMessage(f'Cancelled {count} downloads!', context.bot, update)
def get_readable_message(): with download_dict_lock: msg = "" INDEX = 0 if STATUS_LIMIT is not None: dick_no = len(download_dict) global pages pages = math.ceil(dick_no / STATUS_LIMIT) if PAGE_NO > pages and pages != 0: globals()['COUNT'] -= STATUS_LIMIT globals()['PAGE_NO'] -= 1 for download in list(download_dict.values()): INDEX += 1 if INDEX > COUNT: msg += f"<b>Filename:</b> <code>{download.name()}</code>" msg += f"\n<b>Status:</b> <i>{download.status()}</i>" if download.status() not in [ MirrorStatus.STATUS_ARCHIVING, MirrorStatus.STATUS_EXTRACTING, ]: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" if download.status() == MirrorStatus.STATUS_CLONING: msg += f"\n<b>Cloned:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>" elif download.status() == MirrorStatus.STATUS_UPLOADING: msg += f"\n<b>Uploaded:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>" else: msg += f"\n<b>Downloaded:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>" msg += f"\n<b>Speed:</b> <code>{download.speed()}</code>" \ f", <b>ETA:</b> <code>{download.eta()}</code> " # if hasattr(download, 'is_torrent'): try: msg += f"\n<b>Seeders:</b> <code>{download.aria_download().num_seeders}</code>" \ f" | <b>Peers:</b> <code>{download.aria_download().connections}</code>" except: pass try: msg += f"\n<b>Seeders:</b> <code>{download.torrent_info().num_seeds}</code>" \ f" | <b>Leechers:</b> <code>{download.torrent_info().num_leechs}</code>" except: pass msg += f"\n<b>To Stop:</b> <code>/{BotCommands.CancelMirror} {download.gid()}</code>" msg += "\n\n" if STATUS_LIMIT is not None and INDEX >= COUNT + STATUS_LIMIT: break if STATUS_LIMIT is not None: if INDEX > COUNT + STATUS_LIMIT: return None, None if dick_no > STATUS_LIMIT: msg += f"Page: <code>{PAGE_NO}/{pages}</code> | <code>Tasks: {dick_no}</code>\n" buttons = button_build.ButtonMaker() buttons.sbutton("Previous", "pre") buttons.sbutton("Next", "nex") button = InlineKeyboardMarkup(buttons.build_menu(2)) return msg, button return msg, ""
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<i>{download.name()}</i> - " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> of " \ f"{download.size()}" \ f" at {download.speed()}, ETA: {download.eta()}\n\n" return msg
def getAllDownload(): with download_dict_lock: for dlDetails in download_dict.values(): status = dlDetails.status() if (status not in [ MirrorStatus.STATUS_ARCHIVING, MirrorStatus.STATUS_EXTRACTING, MirrorStatus.STATUS_CLONING, MirrorStatus.STATUS_UPLOADING, ] and dlDetails): return dlDetails return None
def cancel_all(update, bot): with download_dict_lock: for dlDetails in list(download_dict.values()): if not dlDetails.status() == "Uploading" or dlDetails.status( ) == "Archiving": aria2.pause([dlDetails.download()]) continue if dlDetails.status() == "Queued": dlDetails._listener.onDownloadError( "Download Manually Cancelled By user.") delete_all_messages() sendMessage('Cancelled all downloads!', update, bot) sleep(0.5) # Wait a Second For Aria2 To free Resources. clean_download(DOWNLOAD_DIR)
def get_readable_message(progress_list: list = None): if progress_list is None: with download_dict_lock: progress_list = list(download_dict.values()) msg = '' for status in progress_list: msg += f'<b>Name:</b> {status.name()}\n' \ f'<b>Status:</b> {status.status()}\n' \ f'<code>{get_progress_bar_string(status)}</code> {status.progress()} of {status.size()}\n' \ f'<b>Speed:</b> {status.speed()}\n' \ f'<b>ETA:</b> {status.eta()}\n\n' # LOGGER.info(msg) return msg
def cancel_all(update, bot): with download_dict_lock: count = 0 for dlDetails in list(download_dict.values()): if not dlDetails.status() == "Uploading" or dlDetails.status( ) == "Archiving": aria2.pause([dlDetails.download()]) count += 1 continue if dlDetails.status() == "Queued": count += 1 dlDetails._listener.onDownloadError( "Download Manually Cancelled By user.") delete_all_messages() sendMessage(f'Cancelled {count} downloads!', update, bot)
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>📂 Name:</b> <i>{download.name()}</i>" msg += f"\n<b>Status:</b> <code>{download.status()}</code>" if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)}</code>\n<b>Progress:</b> <i>{download.progress()} of {download.size()}</i>" \ f"\n<b>Speed:</b> {download.speed()}\n<b>ETA:</b> {download.eta()}" if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n<b>Peers:</b> {download.download().connections} " \ f"| <b>Seeds:</b> {download.download().num_seeders}" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>○ File :</b> <code>{download.name()}</code> \n<b>○ Size :</b> {download.size()} \n<b>○ Status :</b> " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)}</code> <b>{download.progress()}</b>" \ f"\n<b>○ Speed :</b> {download.speed()} | <b>○ ETA :</b> {download.eta()} " if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n<b>○ Peers :</b> {download.aria_download().connections} " \ f"| <b>○ Seeders :</b> {download.aria_download().num_seeders}" msg += f"\n\n<code>/cancel {download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<i>{download.name()}</i> - " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING: 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
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>File :</b> <code>{download.name()}</code>" msg += f"\n<b>Status :</b> <code>{download.status()}</code>" if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" \ f"\n<b>Progress :</b> <code>{get_readable_file_size(download.processed_bytes())} / {download.size()}</code>" \ f"\n<b>Stats :</b> <code>{download.speed()}</code> , <code>{download.eta()}</code>" if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n<b>Info :- Seeders:</b> <code>{download.aria_download().num_seeders}</code>" \ f" & <b>Peers :</b> <code>{download.aria_download().connections}</code>" msg += f"\n<code>/cancel {download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "═━✥ ☁️ MeG Cloud ☁️ ✥━═" for download in list(download_dict.values()): msg += f"<b>File Name :</b> <pre>{download.name()}</pre> - " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> of " \ f"<b> Total Size :{download.size()}</b>" f"<b>Speed : {download.speed()}, ETA: {download.eta()} </b>" if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"| Peers : {download.aria_download().connections} " \ f"| Seeds : {download.aria_download().num_seeders}" msg += f"\n<code>/cancel2 {download.gid()}</code>" msg += "\n\n" return msg
def sendStatusMessage(msg, bot): if len(Interval) == 0: Interval.append( setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages)) total, used, free = shutil.disk_usage('.') free = get_readable_file_size(free) currentTime = get_readable_time(time.time() - botStartTime) progress, buttons = get_readable_message() if progress is None: progress, buttons = get_readable_message() progress += f"<b>CPU:</b> <code>{psutil.cpu_percent()}%</code>" \ f" <b>RAM:</b> <code>{psutil.virtual_memory().percent}%</code>" \ f" <b>DISK:</b> <code>{psutil.disk_usage('/').percent}%</code>" with download_dict_lock: dlspeed_bytes = 0 uldl_bytes = 0 for download in list(download_dict.values()): speedy = download.speed() if download.status() == MirrorStatus.STATUS_DOWNLOADING: if 'K' in speedy: dlspeed_bytes += float(speedy.split('K')[0]) * 1024 elif 'M' in speedy: dlspeed_bytes += float(speedy.split('M')[0]) * 1048576 if download.status() == MirrorStatus.STATUS_UPLOADING: if 'KB/s' in speedy: uldl_bytes += float(speedy.split('K')[0]) * 1024 elif 'MB/s' in speedy: uldl_bytes += float(speedy.split('M')[0]) * 1048576 dlspeed = get_readable_file_size(dlspeed_bytes) ulspeed = get_readable_file_size(uldl_bytes) progress += f"\n<b>FREE:</b> <code>{free}</code> | <b>UPTIME:</b> <code>{currentTime}</code>\n<b>DL:</b> <code>{dlspeed}/s</code> 🔻 | <b>UL:</b> <code>{ulspeed}/s</code> 🔺\n" with status_reply_dict_lock: if msg.message.chat.id in list(status_reply_dict.keys()): try: message = status_reply_dict[msg.message.chat.id] deleteMessage(bot, message) del status_reply_dict[msg.message.chat.id] except Exception as e: LOGGER.error(str(e)) del status_reply_dict[msg.message.chat.id] pass if buttons == "": message = sendMessage(progress, bot, msg) else: message = sendMarkup(progress, bot, msg, buttons) status_reply_dict[msg.message.chat.id] = message
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>Name</b>: <code>{download.name()}</code> " msg += f"\n<b>Status</b>: <code>{download.status()}</code>" if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" \ f"\n<b>Size</b>: <code>{download.size()}</code>" \ f"\n<b>Speed</b>: <code>{download.speed()}</code>\n<b>ETA</b>: <code>{download.eta()}</code> " if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n<b>Seeders</b>: <code>{download.aria_download().num_seeders}</code>" \ f"& <b>Peers</b>: {download.aria_download().connections} " msg += f"\nGID: <code>{download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f'<i>{download.status()}...</i>\n' msg += f'<b>Name :</b> {download.name()}\n' if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f'<b>Progress :</b> <code>{get_progress_bar_string(download)}</code>\n' \ f'<b>Percentage :</b> {download.progress()}\n' \ f'<b>Total Size :</b> {download.size()}\n' \ f'<b>Speed :</b> {download.speed()}\n' \ f'<b>ETA :</b> {download.eta()}' if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download,'is_torrent'): msg += f" <b>|| P :</b> {download.download().connections} " \ f"<b>|| S :</b> {download.download().num_seeders}" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>Nama File :</b> <i>{download.name()}</i> \n\n<b>Status : </b> " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING: msg += f"\n\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" \ f"\n\n<b>Proses :</b> {get_readable_file_size(download.processed_bytes())}" \ f"\n\n<b>Size :</b> {download.size()}" \ f"\n\n<b>Speed :</b> {download.speed()} <b>| ETA :</b> {download.eta()} " if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n\n<b>Peer :</b> {download.aria_download().connections} " \ f"<b>| Seed :</b> {download.aria_download().num_seeders}" msg += f"\n\n<b>Batal :</b> <code>/batal {download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>📂Nama File/Folder :</b> <code>{download.name()}</code>" msg += f"\n<b>Status👨💻 :</b> <i>{download.status()}</i>" if download.status( ) != MirrorStatus.STATUS_ARCHIVING and download.status( ) != MirrorStatus.STATUS_EXTRACTING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> of {download.size()}" \ f"\n<b>File yang Kedownload 🧬 :</b> {download.size()}" \ f"\n<b>Kecepatan Internet⚡️:</b> {download.speed()}, \n<b>Perkiraan selesai⏳:- </b> {download.eta()} " if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg+= f"\n<b>Info 🐳 :- Seeders:</b> {download.aria_download().num_seeders}" \ f" & <b>Peers 🍐 :</b> {download.aria_download().connections}" msg += f"\nGID: <code>{download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>📁 File Name :</b> <code>{download.name()}</code>" msg += f"\n<b>🌀 Status : {download.status()}</b>" if download.status( ) != MirrorStatus.STATUS_ARCHIVING and download.status( ) != MirrorStatus.STATUS_EXTRACTING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" \ f"\n<b>🔻 Downloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}</b>" \ f"\n<b>⚡️ Speed : {download.speed()}</b>\n<b>⏳ ETA :- {download.eta()}</b>" if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"\n<b>🔍 Tracker :- 🧲 Seeders :- {download.aria_download().num_seeders}</b>" \ f" | <b>🧲 Peers :- {download.aria_download().connections}</b>" msg += f"\n<b>🚫 Cancel :</b> <code>/{BotCommands.CancelMirror} {download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>FileName:</b> <i>{download.name()}</i> \n<b>Status:</b> " msg += download.status() if download.status( ) != MirrorStatus.STATUS_ARCHIVING and download.status( ) != MirrorStatus.STATUS_EXTRACTING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> \n<b>Size:</b> " \ f"{download.size()}" \ f"\n<b>Speed:</b> {download.speed()},\n<b>ETA:</b> {download.eta()} " if download.status() == MirrorStatus.STATUS_DOWNLOADING: if hasattr(download, 'is_torrent'): msg += f"| P: {download.aria_download().connections} " \ f"| S: {download.aria_download().num_seeders}" msg += f"\n<b>GID:</b>: <code>{download.gid()}</code>" msg += "\n\n" return msg
def update_all_messages(): msg = get_readable_message() msg += f"<b>CPU:</b> {psutil.cpu_percent()}%" \ f" <b>DISK:</b> {psutil.disk_usage('/').percent}%" \ f" <b>RAM:</b> {psutil.virtual_memory().percent}%" with download_dict_lock: dlspeed_bytes = 0 uldl_bytes = 0 for download in list(download_dict.values()): speedy = download.speed() if download.status() == MirrorStatus.STATUS_DOWNLOADING: if 'KiB/s' in speedy: dlspeed_bytes += float(speedy.split('K')[0]) * 1024 elif 'MiB/s' in speedy: dlspeed_bytes += float(speedy.split('M')[0]) * 1048576 if download.status() == MirrorStatus.STATUS_UPLOADING: if 'KB/s' in speedy: uldl_bytes += float(speedy.split('K')[0]) * 1024 elif 'MB/s' in speedy: uldl_bytes += float(speedy.split('M')[0]) * 1048576 dlspeed = get_readable_file_size(dlspeed_bytes) ulspeed = get_readable_file_size(uldl_bytes) msg += f"\n<b>DL:</b> {dlspeed}ps 🔻| <b>UL:</b> {ulspeed}ps 🔺\n" with status_reply_dict_lock: for chat_id in list(status_reply_dict.keys()): if status_reply_dict[ chat_id] and msg != status_reply_dict[chat_id].text: if len(msg) == 0: msg = "Starting DL" try: keyboard = [[ InlineKeyboardButton("🔄 REFRESH 🔄", callback_data=str(ONE)), InlineKeyboardButton("❌ CLOSE ❌", callback_data=str(TWO)), ]] editMessage(msg, status_reply_dict[chat_id], reply_markup=InlineKeyboardMarkup(keyboard)) except Exception as e: LOGGER.error(str(e)) status_reply_dict[chat_id].text = msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<i>{download.name()}</i> - " msg += download.status() if download.status() != MirrorStatus.STATUS_ARCHIVING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code> | " \ f"{get_readable_file_size(download.processed_bytes())}/{download.size()}" \ f"\n<b>Speed</b> {download.speed()}, \n<b>ETA:</b> {download.eta()} " # if hasattr(download, 'is_torrent'): try: msg += f"\n| <b>P:</b> {download.aria_download().connections} " \ f"| <b>S:</b> {download.aria_download().num_seeders}" except: pass if download.status() == MirrorStatus.STATUS_DOWNLOADING: msg += f"\n<b>GID</b>: <code>{download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "<b>✥════ @fcuksociety69════✥</b>" for download in list(download_dict.values()): msg += f"\n📁 𝗙𝗶𝗹𝗲𝗡𝗮𝗺𝗲: <code>{download.name()}</code>" msg += f"\n {download.status()}" if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING: msg += f"\n{get_progress_bar_string(download)} {download.progress()}" \ f"\n<b>○ Done ✓:</b> {get_readable_file_size(download.processed_bytes())} of {download.size()}" \ f"\n<b>○ Speed :</b> {download.speed()}, \n<b>○ ETA:</b> {download.eta()} " # if hasattr(download, 'is_torrent'): try: msg += f"\n<b>○ Seeders:</b> {download.aria_download().num_seeders}" \ f" & <b>○ Peers :</b> {download.aria_download().connections}" except: pass if download.status() == MirrorStatus.STATUS_DOWNLOADING: msg += f"\n<b>○ ⛔</b>: <code> /cancel1 {download.gid()}</code>" msg += "\n\n" return msg
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"<b>Nama File :</b> <code>{download.name()}</code>" msg += f"\n<b>Status :</b> <i>{download.status()}</i>" if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING: msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>" \ f"\n<b>Terdownload :</b> {get_readable_file_size(download.processed_bytes())} of {download.size()}" \ f"\n<b>Kecepatan :</b> {download.speed()}, \n<b>ETA:</b> {download.eta()} " # if hasattr(download, 'is_torrent'): try: msg += f"\n<b>Info :- Seeders:</b> {download.aria_download().num_seeders}" \ f" & <b>Peers :</b> {download.aria_download().connections}" except: pass if download.status() == MirrorStatus.STATUS_DOWNLOADING: msg += f"\n<b>GID</b>: <code>{download.gid()}</code>" msg += "\n\n" return msg
def sendStatusMessage(msg, bot): total, used, free = shutil.disk_usage('.') free = get_readable_file_size(free) currentTime = get_readable_time(time.time() - botStartTime) progress = get_readable_message() progress += f"<b>CPU:</b> {psutil.cpu_percent()}%" \ f" <b>RAM:</b> {psutil.virtual_memory().percent}%" \ f" <b>DISK:</b> {psutil.disk_usage('/').percent}%" with download_dict_lock: dlspeed_bytes = 0 uldl_bytes = 0 for download in list(download_dict.values()): speedy = download.speed() if download.status() == MirrorStatus.STATUS_DOWNLOADING: if 'KiB/s' in speedy: dlspeed_bytes += float(speedy.split('K')[0]) * 1024 elif 'MiB/s' in speedy: dlspeed_bytes += float(speedy.split('M')[0]) * 1048576 if download.status() == MirrorStatus.STATUS_UPLOADING: if 'KB/s' in speedy: uldl_bytes += float(speedy.split('K')[0]) * 1024 elif 'MB/s' in speedy: uldl_bytes += float(speedy.split('M')[0]) * 1048576 dlspeed = get_readable_file_size(dlspeed_bytes) ulspeed = get_readable_file_size(uldl_bytes) progress += f"\n<b>FREE:</b> {free} | <b>UPTIME:</b> {currentTime}\n<b>DL:</b> {dlspeed}ps 🔻 | <b>UL:</b> {ulspeed}ps 🔺\n" with status_reply_dict_lock: if msg.message.chat.id in list(status_reply_dict.keys()): try: message = status_reply_dict[msg.message.chat.id] deleteMessage(bot, message) del status_reply_dict[msg.message.chat.id] except Exception as e: LOGGER.error(str(e)) del status_reply_dict[msg.message.chat.id] pass if len(progress) == 0: progress = "Starting DL" message = sendMessage(progress, bot, msg) status_reply_dict[msg.message.chat.id] = message
def get_readable_message(): with download_dict_lock: msg = "" for download in list(download_dict.values()): msg += f"📂𝗙𝗜𝗟𝗘 𝗡𝗔𝗠𝗘: <code>{download.name()}</code>" msg += f"\n {download.status()}" if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING: msg += f"\n{get_progress_bar_string(download)} ○<b>P</b>:<code>〘{download.progress()}〙</code>" \ f"\n○<b>COMPLETE</b>:<code>〘 {get_readable_file_size(download.processed_bytes())} 〙</code>" \ f"\n○<b>SPEED</b>:<code>〘{download.speed()}〙</code>" \ f"\n○<b>ETA</b>:<code>〘{download.eta()}〙</code><b>○Total Size</b>:<code>〘{download.size()}〙</code>" # if hasattr(download, 'is_torrent'): try: msg += f"\n○<b>PEERS</b>:<code>〘{download.aria_download().connections}〙</code> " \ f"|○<b>SEEDERS</b>:<code>〘{download.aria_download().num_seeders}〙</code>" except: pass if download.status() == MirrorStatus.STATUS_DOWNLOADING: msg += f"\n○<b>CANCEL</b> <code>/cancel {download.gid()}</code>" msg += "\n\n" return msg