When using
If the power goes down in the middle of the operation, the file will be in a inconsistent state, and the library won't know this unless your code has some protections against it, as pointed out by https://github.com/LonamiWebs/Telethon/issues/1647.
One solution is to download the path to a temporary directory and iff the entire download succeeds, move it to the location you asked for. However this means you won't know where the file is and thus can't stat or read from it.
Regardless, to check the progress,
client.download_media
to download media into a local path (str
or Path
), do you use the partial contents of the file as it gets downloaded in some way? That is, do you read or stat the same path while the download is ongoing?If the power goes down in the middle of the operation, the file will be in a inconsistent state, and the library won't know this unless your code has some protections against it, as pointed out by https://github.com/LonamiWebs/Telethon/issues/1647.
One solution is to download the path to a temporary directory and iff the entire download succeeds, move it to the location you asked for. However this means you won't know where the file is and thus can't stat or read from it.
Regardless, to check the progress,
progress_callback
is the only way to do this, and is directly supported by the library, which should be preferred over using stat on the file.Do you read from or stat the file download_media creates while it's downloading?
Anonymous Poll
40%
Yes
60%
No
Telethon Updates pinned «When using client.download_media to download media into a local path (str or Path), do you use the partial contents of the file as it gets downloaded in some way? That is, do you read or stat the same path while the download is ongoing? If the power goes…»
Those who vote yes, please indicate your use case in the official group, as I'd love to hear it
Voice Calls and Telethon
A few people have asked now whether Telethon will support the new Telegram calls. The answer is: Telethon will contain the raw API methods needed to initiate and manage calls (and in fact, already does in the version available in the GitHub repository). You can play around with them by installing Telethon from GitHub, and you can also build the offline TL reference for the new layer if you prefer looking at the new methods this way (and not using an IDE or Python's
Telethon will likely not offer ways to stream audio directly. Telethon's focus is being an
However, that doesn't mean calls are not possible with Telethon. If you want to help design a Python library to perform audio calls, which can then be used with Telethon (so you can use Telethon + that new library to perform calls with Telethon), please refer to @pytgcallschat and join the relevant chat to discuss and help with the implementation!
I simply don't have the time or interest to dedicate myself to work on calls too, which is why it should be an outside effort first.
A few people have asked now whether Telethon will support the new Telegram calls. The answer is: Telethon will contain the raw API methods needed to initiate and manage calls (and in fact, already does in the version available in the GitHub repository). You can play around with them by installing Telethon from GitHub, and you can also build the offline TL reference for the new layer if you prefer looking at the new methods this way (and not using an IDE or Python's
help(…)
).Telethon will likely not offer ways to stream audio directly. Telethon's focus is being an
asyncio
-based, pure-Python implementation to interact with Telegram's API. Streaming audio is beyond the current scope of the project and would be a big undertaking.However, that doesn't mean calls are not possible with Telethon. If you want to help design a Python library to perform audio calls, which can then be used with Telethon (so you can use Telethon + that new library to perform calls with Telethon), please refer to @pytgcallschat and join the relevant chat to discuss and help with the implementation!
I simply don't have the time or interest to dedicate myself to work on calls too, which is why it should be an outside effort first.
Telethon Updates pinned «Voice Calls and Telethon A few people have asked now whether Telethon will support the new Telegram calls. The answer is: Telethon will contain the raw API methods needed to initiate and manage calls (and in fact, already does in the version available in…»