Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add progress bar in download file #487

Open
rafaael1 opened this issue Feb 17, 2024 · 0 comments
Open

add progress bar in download file #487

rafaael1 opened this issue Feb 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@rafaael1
Copy link

It is possible to add a progress bar to monitor the download of files ?

I tried using a callback function, but the progress bar appears only once. Code below:

def download_progress(current, total):
    global pbar
    global prev_curr
    pbar.update(current - prev_curr)
    prev_curr = current

And,

async def download_media(...):
....
     if _can_download(_type, file_formats, file_format):
         global pbar
         global prev_curr
         ...
                    prev_curr = 0
                    pbar = tqdm(
                            total=getattr(message, _type).file_size, desc="Downloading...", leave=False,
                            unit='B', unit_scale=True
                     )
                     pbar.clear()

Output:

image

@Dineshkarthik Dineshkarthik added the enhancement New feature or request label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants