diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-13 13:35:38 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-13 13:35:38 +0200 |
commit | c670ed8ce26749442c180dbf8a0a60c153f5d5c4 (patch) | |
tree | 22bf23e6ff941d138d08b637f17be683d0f77990 | |
parent | fdb6e2a140c4f103602e04d782dfbd849e2de788 (diff) | |
download | mastodon.py-c670ed8ce26749442c180dbf8a0a60c153f5d5c4.tar.gz |
Update information about dicts (media colors, card blurhash)
-rw-r--r-- | TODO.md | 2 | ||||
-rw-r--r-- | docs/index.rst | 17 | ||||
-rw-r--r-- | mastodon/Mastodon.py | 4 |
3 files changed, 18 insertions, 5 deletions
@@ -16,7 +16,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m | |||
16 | ----- | 16 | ----- |
17 | * [ ] Add personal notes for accounts | 17 | * [ ] Add personal notes for accounts |
18 | * [x] Add customizable thumbnails for audio and video attachments | 18 | * [x] Add customizable thumbnails for audio and video attachments |
19 | * [ ] Add color extraction for thumbnails | 19 | * [x] Add color extraction for thumbnails |
20 | 20 | ||
21 | 3.3.0 | 21 | 3.3.0 |
22 | ----- | 22 | ----- |
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 | |||
571 | 'remote_url': # The remote URL for the media (if the image is from a remote instance) | 571 | 'remote_url': # The remote URL for the media (if the image is from a remote instance) |
572 | 'preview_url': # The URL for the media preview | 572 | 'preview_url': # The URL for the media preview |
573 | 'text_url': # The display text for the media (what shows up in toots) | 573 | 'text_url': # The display text for the media (what shows up in toots) |
574 | 'meta': # Dictionary of two image metadata dicts (see below), | 574 | 'meta': # Dictionary of two metadata dicts (see below), |
575 | # 'original' and 'small' (preview). Either may be empty. | 575 | # 'original' and 'small' (preview). Either may be empty. |
576 | # May additionally contain an "fps" field giving a videos frames per second (possibly | 576 | # May additionally contain an "fps" field giving a videos frames per second (possibly |
577 | # rounded), and a "length" field giving a videos length in a human-readable format. | 577 | # rounded), and a "length" field giving a videos length in a human-readable format. |
578 | # Note that a video may have an image as preview. | 578 | # Note that a video may have an image as preview. |
579 | # May also contain a 'focus' dict. | 579 | # May also contain a 'focus' dict and a media 'colors' dict. |
580 | 'blurhash': # The blurhash for the image, used for preview / placeholder generation | 580 | 'blurhash': # The blurhash for the image, used for preview / placeholder generation |
581 | 'description': # If set, the user-provided description for this media. | 581 | 'description': # If set, the user-provided description for this media. |
582 | } | 582 | } |
@@ -598,6 +598,12 @@ Media dicts | |||
598 | 'duration': # Duration of the video in seconds | 598 | 'duration': # Duration of the video in seconds |
599 | 'bitrate': # Average bit-rate of the video in bytes per second | 599 | 'bitrate': # Average bit-rate of the video in bytes per second |
600 | } | 600 | } |
601 | |||
602 | # Metadata dicts (audio) - all fields are optional: | ||
603 | { | ||
604 | 'duration': # Duration of the audio file in seconds | ||
605 | 'bitrate': # Average bit-rate of the audio file in bytes per second | ||
606 | } | ||
601 | 607 | ||
602 | # Focus Metadata dict: | 608 | # Focus Metadata dict: |
603 | { | 609 | { |
@@ -605,6 +611,12 @@ Media dicts | |||
605 | 'y': Focus point x coordinate (between -1 and 1) | 611 | 'y': Focus point x coordinate (between -1 and 1) |
606 | } | 612 | } |
607 | 613 | ||
614 | # Media colors dict: | ||
615 | { | ||
616 | 'foreground': # Estimated foreground colour for the attachment thumbnail | ||
617 | 'background': # Estimated background colour for the attachment thumbnail | ||
618 | 'accent': # Estimated accent colour for the attachment thumbnail | ||
619 | |||
608 | Card dicts | 620 | Card dicts |
609 | ~~~~~~~~~~ | 621 | ~~~~~~~~~~ |
610 | .. _card dict: | 622 | .. _card dict: |
@@ -629,6 +641,7 @@ Card dicts | |||
629 | 'html': # HTML string of the embed | 641 | 'html': # HTML string of the embed |
630 | 'provider_name': # Name of the provider from which the embed originates | 642 | 'provider_name': # Name of the provider from which the embed originates |
631 | 'provider_url': # URL pointing to the embeds provider | 643 | 'provider_url': # URL pointing to the embeds provider |
644 | 'blurhash': # (optional) Blurhash of the preview image | ||
632 | } | 645 | } |
633 | 646 | ||
634 | Search result dicts | 647 | 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: | |||
208 | # Dict versions | 208 | # Dict versions |
209 | __DICT_VERSION_APPLICATION = "2.7.2" | 209 | __DICT_VERSION_APPLICATION = "2.7.2" |
210 | __DICT_VERSION_MENTION = "1.0.0" | 210 | __DICT_VERSION_MENTION = "1.0.0" |
211 | __DICT_VERSION_MEDIA = "2.8.2" | 211 | __DICT_VERSION_MEDIA = "3.2.0" |
212 | __DICT_VERSION_ACCOUNT = "3.1.0" | 212 | __DICT_VERSION_ACCOUNT = "3.1.0" |
213 | __DICT_VERSION_POLL = "2.8.0" | 213 | __DICT_VERSION_POLL = "2.8.0" |
214 | __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) | 214 | __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: | |||
219 | __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) | 219 | __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) |
220 | __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) | 220 | __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) |
221 | __DICT_VERSION_LIST = "2.1.0" | 221 | __DICT_VERSION_LIST = "2.1.0" |
222 | __DICT_VERSION_CARD = "2.0.0" | 222 | __DICT_VERSION_CARD = "3.2.0" |
223 | __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG) | 223 | __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG) |
224 | __DICT_VERSION_ACTIVITY = "2.1.2" | 224 | __DICT_VERSION_ACTIVITY = "2.1.2" |
225 | __DICT_VERSION_REPORT = "2.9.1" | 225 | __DICT_VERSION_REPORT = "2.9.1" |