From c670ed8ce26749442c180dbf8a0a60c153f5d5c4 Mon Sep 17 00:00:00 2001 From: halcy Date: Sun, 13 Nov 2022 13:35:38 +0200 Subject: [PATCH] Update information about dicts (media colors, card blurhash) --- TODO.md | 2 +- docs/index.rst | 17 +++++++++++++++-- mastodon/Mastodon.py | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index b470133..4bce5da 100644 --- a/TODO.md +++ b/TODO.md @@ -16,7 +16,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m ----- * [ ] Add personal notes for accounts * [x] Add customizable thumbnails for audio and video attachments -* [ ] Add color extraction for thumbnails +* [x] Add color extraction for thumbnails 3.3.0 ----- diff --git a/docs/index.rst b/docs/index.rst index 650a497..667ab1c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -571,12 +571,12 @@ Media dicts 'remote_url': # The remote URL for the media (if the image is from a remote instance) 'preview_url': # The URL for the media preview 'text_url': # The display text for the media (what shows up in toots) - 'meta': # Dictionary of two image metadata dicts (see below), + 'meta': # Dictionary of two metadata dicts (see below), # 'original' and 'small' (preview). Either may be empty. # May additionally contain an "fps" field giving a videos frames per second (possibly # rounded), and a "length" field giving a videos length in a human-readable format. # Note that a video may have an image as preview. - # May also contain a 'focus' dict. + # May also contain a 'focus' dict and a media 'colors' dict. 'blurhash': # The blurhash for the image, used for preview / placeholder generation 'description': # If set, the user-provided description for this media. } @@ -598,6 +598,12 @@ Media dicts 'duration': # Duration of the video in seconds 'bitrate': # Average bit-rate of the video in bytes per second } + + # Metadata dicts (audio) - all fields are optional: + { + 'duration': # Duration of the audio file in seconds + 'bitrate': # Average bit-rate of the audio file in bytes per second + } # Focus Metadata dict: { @@ -605,6 +611,12 @@ Media dicts 'y': Focus point x coordinate (between -1 and 1) } + # Media colors dict: + { + 'foreground': # Estimated foreground colour for the attachment thumbnail + 'background': # Estimated background colour for the attachment thumbnail + 'accent': # Estimated accent colour for the attachment thumbnail + Card dicts ~~~~~~~~~~ .. _card dict: @@ -629,6 +641,7 @@ Card dicts 'html': # HTML string of the embed 'provider_name': # Name of the provider from which the embed originates 'provider_url': # URL pointing to the embeds provider + 'blurhash': # (optional) Blurhash of the preview image } Search result dicts diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index dd30e17..6340abc 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -208,7 +208,7 @@ class Mastodon: # Dict versions __DICT_VERSION_APPLICATION = "2.7.2" __DICT_VERSION_MENTION = "1.0.0" - __DICT_VERSION_MEDIA = "2.8.2" + __DICT_VERSION_MEDIA = "3.2.0" __DICT_VERSION_ACCOUNT = "3.1.0" __DICT_VERSION_POLL = "2.8.0" __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("3.1.0", __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION), __DICT_VERSION_POLL) @@ -219,7 +219,7 @@ class Mastodon: __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) __DICT_VERSION_LIST = "2.1.0" - __DICT_VERSION_CARD = "2.0.0" + __DICT_VERSION_CARD = "3.2.0" __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG) __DICT_VERSION_ACTIVITY = "2.1.2" __DICT_VERSION_REPORT = "2.9.1"