-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, TootNotify is able to truncate the attached media files to a maximum of 4 files (which is the maximum number of IMAGES allowed), and send the Toot without media if the set of media files provided generate an Exception for the API.
However, it does not actively know how many images, GIFs, video files, and audio files have been passed to be included in the Toot. This means it can not enforce Mastodon's restrictions on media attachment for Toots, and relies on the API to return error codes and messages.
The restrictions to be enforced are: a Toot may contain text and either:
- one or more (maximum 4) image files, or
- exactly one GIF image file, or
- exactly one video file,
- exactly one audio file
Lazy approach: make a function that checks the list of media_ids returned from uploading the media to Mastodon, and enforces these restrictions by only keeping the best permitted set of media files (this wastes bandwidth and uploads files to Mastodon that may be then discarded).
Proactive approach: make a function that checks the list of media files for their MIME types BEFORE submitting them to Mastodon, and only submit the best permitted set of media files, as per the above restrictions.