Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
issue #3: give option to change bar size
Browse files Browse the repository at this point in the history
  • Loading branch information
azamaulanaaa committed Sep 30, 2020
1 parent eac195d commit 4b76bd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
'CHAT_ID' : [],
'EDIT_SLEEP' : 3,
'UPLOAD_MAX_SIZE' : 2000 * 1024 * 1024,
'ARIA2_DIR' : 'downloads'
'ARIA2_DIR' : 'downloads',
'BAR_SIZE' : 10
})

# GOAL:
Expand Down
4 changes: 2 additions & 2 deletions bot/handlers/leech_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ async def progress_dl(message : Message, aria2_api : aria2.aria2, gid : int, pre
if not download.is_complete:
if not download.error_message:
block = ""
for i in range(1, 11):
if i <= floor(download.progress/10):
for i in range(1, CONFIG.BAR_SIZE + 1):
if i <= floor(download.progress * CONFIG.BAR_SIZE/100):
block += LOCAL.BLOCK_FILLED
else:
block += LOCAL.BLOCK_EMPTY
Expand Down
4 changes: 2 additions & 2 deletions bot/handlers/upload_to_tg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ async def upload_fn(chat_id, file, **kwargs):
async def progress_upload_tg(current, total, message, info):
percentage = round(current * 10000 / total) / 100
block = ""
for i in range(1, 11):
if i <= floor(percentage/10):
for i in range(1, CONFIG.BAR_SIZE + 1):
if i <= floor(percentage * CONFIG.BAR_SIZE/100):
block += LOCAL.BLOCK_FILLED
else:
block += LOCAL.BLOCK_EMPTY
Expand Down

0 comments on commit 4b76bd4

Please sign in to comment.