mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-11 08:32:22 +03:00
parent
ad4c49aa18
commit
9a6bc5ae72
|
@ -201,9 +201,14 @@ class UploadMethods:
|
||||||
Optional JPEG thumbnail (for documents). **Telegram will
|
Optional JPEG thumbnail (for documents). **Telegram will
|
||||||
ignore this parameter** unless you pass a ``.jpg`` file!
|
ignore this parameter** unless you pass a ``.jpg`` file!
|
||||||
|
|
||||||
The file must also be small in dimensions and in-disk size.
|
The file must also be small in dimensions and in disk size.
|
||||||
Successful thumbnails were files below 20kb and 200x200px.
|
Successful thumbnails were files below 20kB and 320x320px.
|
||||||
Width/height and dimensions/size ratios may be important.
|
Width/height and dimensions/size ratios may be important.
|
||||||
|
For Telegram to accept a thumbnail, you must provide the
|
||||||
|
dimensions of the underlying media through ``attributes=``
|
||||||
|
with :tl:`DocumentAttributesVideo` or by installing the
|
||||||
|
optional ``hachoir`` dependency.
|
||||||
|
|
||||||
|
|
||||||
allow_cache (`bool`, optional):
|
allow_cache (`bool`, optional):
|
||||||
This parameter currently does nothing, but is kept for
|
This parameter currently does nothing, but is kept for
|
||||||
|
|
|
@ -694,10 +694,10 @@ def get_attributes(file, *, attributes=None, mime_type=None,
|
||||||
if m:
|
if m:
|
||||||
doc = types.DocumentAttributeVideo(
|
doc = types.DocumentAttributeVideo(
|
||||||
round_message=video_note,
|
round_message=video_note,
|
||||||
w=m.get('width') if m.has('width') else 0,
|
w=m.get('width') if m.has('width') else 1,
|
||||||
h=m.get('height') if m.has('height') else 0,
|
h=m.get('height') if m.has('height') else 1,
|
||||||
duration=int(m.get('duration').seconds
|
duration=int(m.get('duration').seconds
|
||||||
if m.has('duration') else 0),
|
if m.has('duration') else 1),
|
||||||
supports_streaming=supports_streaming
|
supports_streaming=supports_streaming
|
||||||
)
|
)
|
||||||
elif thumb:
|
elif thumb:
|
||||||
|
@ -708,7 +708,7 @@ def get_attributes(file, *, attributes=None, mime_type=None,
|
||||||
width = t_m.get("width")
|
width = t_m.get("width")
|
||||||
if t_m and t_m.has("height"):
|
if t_m and t_m.has("height"):
|
||||||
height = t_m.get("height")
|
height = t_m.get("height")
|
||||||
|
|
||||||
doc = types.DocumentAttributeVideo(
|
doc = types.DocumentAttributeVideo(
|
||||||
0, width, height, round_message=video_note,
|
0, width, height, round_message=video_note,
|
||||||
supports_streaming=supports_streaming)
|
supports_streaming=supports_streaming)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user