2017-05-26 07:25:37 +03:00
|
|
|
from aiogram.types.photo_size import PhotoSize
|
Add types: Audio, Document, PhotoSize, Sticker, Video, VideoNote, CallbackQuery, Contact, File, Location, UserProfilePhotos, Venue, Voice
2017-05-26 03:27:22 +03:00
|
|
|
from . import Deserializable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Video(Deserializable):
|
2017-05-26 03:51:21 +03:00
|
|
|
def __init__(self, file_id, width, height, duration, thumb, mime_type, file_size):
|
2017-05-26 07:25:37 +03:00
|
|
|
self.file_id: str = file_id
|
|
|
|
|
self.width: int = width
|
|
|
|
|
self.height: int = height
|
|
|
|
|
self.duration: int = duration
|
|
|
|
|
self.thumb: PhotoSize = thumb
|
Add types: Audio, Document, PhotoSize, Sticker, Video, VideoNote, CallbackQuery, Contact, File, Location, UserProfilePhotos, Venue, Voice
2017-05-26 03:27:22 +03:00
|
|
|
self.mime_type = mime_type
|
2017-05-26 07:25:37 +03:00
|
|
|
self.file_size: int = file_size
|
Add types: Audio, Document, PhotoSize, Sticker, Video, VideoNote, CallbackQuery, Contact, File, Location, UserProfilePhotos, Venue, Voice
2017-05-26 03:27:22 +03:00
|
|
|
|
|
|
|
|
@classmethod
|
2017-05-26 03:51:21 +03:00
|
|
|
def de_json(cls, raw_data):
|
|
|
|
|
raw_data = cls.check_json(raw_data)
|
Add types: Audio, Document, PhotoSize, Sticker, Video, VideoNote, CallbackQuery, Contact, File, Location, UserProfilePhotos, Venue, Voice
2017-05-26 03:27:22 +03:00
|
|
|
|
2017-05-26 03:51:21 +03:00
|
|
|
file_id = raw_data.get('file_id')
|
|
|
|
|
width = raw_data.get('width')
|
|
|
|
|
height = raw_data.get('height')
|
|
|
|
|
duration = raw_data.get('duration')
|
2017-05-26 07:25:37 +03:00
|
|
|
thumb = PhotoSize.deserialize(raw_data.get('thumb'))
|
2017-05-26 03:51:21 +03:00
|
|
|
mime_type = raw_data.get('mime_type')
|
|
|
|
|
file_size = raw_data.get('file_size')
|
Add types: Audio, Document, PhotoSize, Sticker, Video, VideoNote, CallbackQuery, Contact, File, Location, UserProfilePhotos, Venue, Voice
2017-05-26 03:27:22 +03:00
|
|
|
|
2017-05-26 03:51:21 +03:00
|
|
|
return Video(file_id, width, height, duration, thumb, mime_type, file_size)
|