2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-07 09:45:14 +00:00

Rework download_media to accommodate L100 changes

This commit is contained in:
Dan
2019-05-29 10:40:37 +02:00
parent 3208b22849
commit 55599e33c6
3 changed files with 166 additions and 127 deletions

View File

@@ -19,6 +19,7 @@
import os
import platform
import re
from collections import namedtuple
from queue import Queue
from threading import Lock
@@ -56,7 +57,7 @@ class BaseClient:
CONFIG_FILE = "./config.ini"
MEDIA_TYPE_ID = {
0: "thumbnail",
0: "photo_thumbnail",
1: "chat_photo",
2: "photo",
3: "voice",
@@ -65,7 +66,8 @@ class BaseClient:
8: "sticker",
9: "audio",
10: "animation",
13: "video_note"
13: "video_note",
14: "document_thumbnail"
}
mime_types_to_extensions = {}
@@ -82,6 +84,10 @@ class BaseClient:
mime_types_to_extensions[mime_type] = " ".join(extensions)
fields = ("media_type", "dc_id", "file_id", "access_hash", "thumb_size", "peer_id", "volume_id", "local_id",
"is_big", "file_size", "mime_type", "file_name", "date")
FileData = namedtuple("FileData", fields, defaults=(None,) * len(fields))
def __init__(self):
self.is_bot = None
self.dc_id = None