2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add ttl_seconds field to Video objects

This commit is contained in:
Dan 2020-04-20 22:40:39 +02:00
parent 99604baaf4
commit 72e150ca13
2 changed files with 10 additions and 2 deletions

View File

@ -561,7 +561,8 @@ class Message(Object, Update):
if video_attributes.round_message: if video_attributes.round_message:
video_note = pyrogram.VideoNote._parse(client, doc, video_attributes) video_note = pyrogram.VideoNote._parse(client, doc, video_attributes)
else: else:
video = pyrogram.Video._parse(client, doc, video_attributes, file_name) video = pyrogram.Video._parse(client, doc, video_attributes, file_name,
media.ttl_seconds)
elif types.DocumentAttributeSticker in attributes: elif types.DocumentAttributeSticker in attributes:
sticker = pyrogram.Sticker._parse( sticker = pyrogram.Sticker._parse(
client, doc, client, doc,

View File

@ -51,6 +51,9 @@ class Video(Object):
mime_type (``str``, *optional*): mime_type (``str``, *optional*):
Mime type of a file as defined by sender. Mime type of a file as defined by sender.
ttl_seconds (``int``):
Time-to-live seconds, for secret photos.
supports_streaming (``bool``, *optional*): supports_streaming (``bool``, *optional*):
True, if the video was uploaded with streaming support. True, if the video was uploaded with streaming support.
@ -75,6 +78,7 @@ class Video(Object):
duration: int, duration: int,
file_name: str = None, file_name: str = None,
mime_type: str = None, mime_type: str = None,
ttl_seconds: int = None,
supports_streaming: bool = None, supports_streaming: bool = None,
file_size: int = None, file_size: int = None,
date: int = None, date: int = None,
@ -89,6 +93,7 @@ class Video(Object):
self.duration = duration self.duration = duration
self.file_name = file_name self.file_name = file_name
self.mime_type = mime_type self.mime_type = mime_type
self.ttl_seconds = ttl_seconds
self.supports_streaming = supports_streaming self.supports_streaming = supports_streaming
self.file_size = file_size self.file_size = file_size
self.date = date self.date = date
@ -99,7 +104,8 @@ class Video(Object):
client, client,
video: types.Document, video: types.Document,
video_attributes: types.DocumentAttributeVideo, video_attributes: types.DocumentAttributeVideo,
file_name: str file_name: str,
ttl_seconds: int = None
) -> "Video": ) -> "Video":
return Video( return Video(
file_id=encode_file_id( file_id=encode_file_id(
@ -117,6 +123,7 @@ class Video(Object):
duration=video_attributes.duration, duration=video_attributes.duration,
file_name=file_name, file_name=file_name,
mime_type=video.mime_type, mime_type=video.mime_type,
ttl_seconds=ttl_seconds,
supports_streaming=video_attributes.supports_streaming, supports_streaming=video_attributes.supports_streaming,
file_size=video.size, file_size=video.size,
date=video.date, date=video.date,