From 42cd135009fc60717eafe5e58a116a5f30ca2f03 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 30 Mar 2020 14:39:16 +0200 Subject: [PATCH] Add missing download_media progress example --- pyrogram/client/methods/messages/download_media.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyrogram/client/methods/messages/download_media.py b/pyrogram/client/methods/messages/download_media.py index 07f7768d..22054397 100644 --- a/pyrogram/client/methods/messages/download_media.py +++ b/pyrogram/client/methods/messages/download_media.py @@ -99,6 +99,12 @@ class DownloadMedia(BaseClient): # Download from file id app.download_media("CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") + + # Keep track of the progress while downloading + def progress(current, total): + print("{:.1f}%".format(current * 100 / total)) + + app.download_media(message, progress=progress) """ error_message = "This message doesn't contain any downloadable media" available_media = ("audio", "document", "photo", "sticker", "animation", "video", "voice", "video_note")