A custom class that holds the cache of a specific client and class functions. attributes: client: the client that the cache is for. cached_file_ids: a dict of cached file IDs. cached_file_properties: a dict of cached file properties.
(self, client: Client)
| 14 | |
| 15 | class ByteStreamer: |
| 16 | def __init__(self, client: Client): |
| 17 | """A custom class that holds the cache of a specific client and class functions. |
| 18 | attributes: |
| 19 | client: the client that the cache is for. |
| 20 | cached_file_ids: a dict of cached file IDs. |
| 21 | cached_file_properties: a dict of cached file properties. |
| 22 | |
| 23 | functions: |
| 24 | generate_file_properties: returns the properties for a media of a specific message contained in Tuple. |
| 25 | generate_media_session: returns the media session for the DC that contains the media file. |
| 26 | yield_file: yield a file from telegram servers for streaming. |
| 27 | |
| 28 | This is a modified version of the <https://github.com/eyaadh/megadlbot_oss/blob/master/mega/telegram/utils/custom_download.py> |
| 29 | Thanks to Eyaadh <https://github.com/eyaadh> |
| 30 | """ |
| 31 | self.clean_timer = 30 * 60 |
| 32 | self.client: Client = client |
| 33 | self.cached_file_ids: Dict[int, FileId] = {} |
| 34 | asyncio.create_task(self.clean_cache()) |
| 35 | |
| 36 | async def get_file_properties(self, id: int) -> FileId: |
| 37 | """ |
nothing calls this directly
no test coverage detected