diff --git a/.coverage b/.coverage index b3cf506..95518a8 100644 Binary files a/.coverage and b/.coverage differ diff --git a/src/mastodon/model/media.py b/src/mastodon/model/media.py index ad8948e..f2a38ef 100644 --- a/src/mastodon/model/media.py +++ b/src/mastodon/model/media.py @@ -2,19 +2,33 @@ from pydantic import BaseModel, Field from typing import Optional class MetaData(BaseModel): - width: int - height: int - size: str - aspect: float + width: Optional[int] = None + height: Optional[int] = None + size: Optional[str] = None + aspect: Optional[float] = None + frame_rate: Optional[str] = None + duration: Optional[float] = None + bitrate: Optional[int] = None class MetaCoordinates(BaseModel): x: float y: float class Meta(BaseModel): + length: Optional[str] = None + duration: Optional[float] = None + fps: Optional[int] = None + size: Optional[str] = None + width: Optional[int] = None + height: Optional[int]= None + aspect: Optional[float] = None + audio_encode: Optional[str] = None + audio_bitrate: Optional[str] = None + audio_channels: Optional[str] = None + original: MetaData small: MetaData - focus: Optional[MetaCoordinates] + focus: Optional[MetaCoordinates] = None class MediaAttachment(BaseModel): media_id: str = Field(alias="id") diff --git a/src/mastodon/model/status.py b/src/mastodon/model/status.py index 114f828..4c0f60d 100644 --- a/src/mastodon/model/status.py +++ b/src/mastodon/model/status.py @@ -28,7 +28,7 @@ class Status(BaseModel): bookmarked: bool content: str reblog: Optional["Status"] -# application: Optional[Application] + application: Optional[Application] = None account: Account media_attachments: List[MediaAttachment] mentions: List diff --git a/src/mastodon/timelines.py b/src/mastodon/timelines.py index 9e05670..ba6bd05 100644 --- a/src/mastodon/timelines.py +++ b/src/mastodon/timelines.py @@ -23,5 +23,5 @@ class Timelines(): parameters["limit"] = limit response = requests.get(url, headers=self.auth.get_auth_headers(), params=parameters) - logger.debug("JSON: {}".format(response.raw())) + logger.debug("JSON: {}".format(response.raw)) return response.json() diff --git a/tests/resources/status.json b/tests/resources/status.json index b24ebca..e93e0d0 100644 --- a/tests/resources/status.json +++ b/tests/resources/status.json @@ -83,7 +83,43 @@ }, "description": "test media description", "blurhash": "UFBWY:8_0Jxv4mx]t8t64.%M-:IUWGWAt6M}" -}], +}, +{ + "id": "22546306", + "type": "video", + "url": "https://files.mastodon.social/media_attachments/files/022/546/306/original/dab9a597f68b9745.mp4", + "preview_url": "https://files.mastodon.social/media_attachments/files/022/546/306/small/dab9a597f68b9745.png", + "remote_url": null, + "text_url": "https://mastodon.social/media/wWd1HJIBmH1MZGDfg50", + "meta": { + "length": "0:01:28.65", + "duration": 88.65, + "fps": 24, + "size": "1280x720", + "width": 1280, + "height": 720, + "aspect": 1.7777777777777777, + "audio_encode": "aac (LC) (mp4a / 0x6134706D)", + "audio_bitrate": "44100 Hz", + "audio_channels": "stereo", + "original": { + "width": 1280, + "height": 720, + "frame_rate": "6159375/249269", + "duration": 88.654, + "bitrate": 862056 + }, + "small": { + "width": 400, + "height": 225, + "size": "400x225", + "aspect": 1.7777777777777777 + } + }, + "description": null, + "blurhash": "U58E0g8_0M.94T?bIr00?bD%NGoM?bD%oLt7" +} +], "mentions": [], "tags": [], "emojis": [],