Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions colab_leecher/downlader/aria2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# copyright 2023 © Xron Trix | https://github.com/Xrontrix10

# Copyright 2023 © Xron Trix | https://github.com/Xrontrix10

import re
import logging
Expand All @@ -8,7 +7,6 @@
from colab_leecher.utility.helper import sizeUnit, status_bar
from colab_leecher.utility.variables import BOT, Aria2c, Paths, Messages, BotTimes


async def aria2_Download(link: str, num: int):
global BotTimes, Messages
name_d = get_Aria2c_Name(link)
Expand All @@ -18,7 +16,8 @@ async def aria2_Download(link: str, num: int):
# Create a command to run aria2p with the link
command = [
"aria2c",
"-x16",
"-x32", # Increase the number of connections
"--max-download-limit=10M", # Limit download speed to 10 MB/s
"--seed-time=0",
"--summary-interval=1",
"--max-tries=3",
Expand Down Expand Up @@ -58,7 +57,6 @@ async def aria2_Download(link: str, num: int):
f"aria2c download failed with return code {exit_code} for {link}.\nError: {error_output}"
)


def get_Aria2c_Name(link):
if len(BOT.Options.custom_name) != 0:
return BOT.Options.custom_name
Expand All @@ -71,7 +69,6 @@ def get_Aria2c_Name(link):
name = "UNKNOWN DOWNLOAD NAME"
return name


async def on_output(output: str):
global link_info
total_size = "0B"
Expand Down Expand Up @@ -121,3 +118,4 @@ async def on_output(output: str):
total_size,
"Aria2c 🧨",
)

9 changes: 4 additions & 5 deletions colab_leecher/uploader/telegram.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# copyright 2023 © Xron Trix | https://github.com/Xrontrix10

# Copyright 2023 © Xron Trix | https://github.com/Xrontrix10

import logging
from PIL import Image
Expand All @@ -12,10 +11,11 @@

async def progress_bar(current, total):
global status_msg, status_head
upload_speed = 4 * 1024 * 1024
elapsed_time_seconds = (datetime.now() - BotTimes.task_start).seconds
if current > 0 and elapsed_time_seconds > 0:
if elapsed_time_seconds > 0:
upload_speed = current / elapsed_time_seconds
else:
upload_speed = 0
eta = (Transfer.total_down_size - current - sum(Transfer.up_bytes)) / upload_speed
percentage = (current + sum(Transfer.up_bytes)) / Transfer.total_down_size * 100
await status_bar(
Expand All @@ -28,7 +28,6 @@ async def progress_bar(current, total):
engine="Pyrogram 💥",
)


async def upload_file(file_path, real_name):
global Transfer, MSG
BotTimes.task_start = datetime.now()
Expand Down