From 8f937c1b1fda8cc0b86ab48ddd0064e7b6defd16 Mon Sep 17 00:00:00 2001 From: BruteWoorse <49795299+brutewooorse@users.noreply.github.com> Date: Thu, 15 Apr 2021 20:21:12 +0800 Subject: [PATCH] Show Current size When Download size Exceeded. (#51) * Show Current size When Download size Exceeded. * Fix typo Co-authored-by: Hafitz Setya <71178188+breakdowns@users.noreply.github.com> --- bot/helper/mirror_utils/download_utils/aria2_download.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py index e13ca13..d2e6690 100644 --- a/bot/helper/mirror_utils/download_utils/aria2_download.py +++ b/bot/helper/mirror_utils/download_utils/aria2_download.py @@ -22,10 +22,11 @@ class AriaDownloadHelper(DownloadHelper): download = api.get_download(gid) self.name = download.name sname = download.name + size = download.total_length if ENABLE_FILESIZE_LIMIT: - if download.total_length / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE: + if size / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE: LOGGER.info(f" Download size Exceeded: {gid}") - dl.getListener().onDownloadError(f'File size larger than Maximum Allowed size {MAX_TORRENT_SIZE}GB') + dl.getListener().onDownloadError(f'File size {get_readable_file_size(size)} larger than Maximum Allowed size {MAX_TORRENT_SIZE}') aria2.remove([download]) return update_all_messages()