[Feature Request] Server may take time to process media #61
Description
After I attached a GIF media and tried to post a new status with it, I got an error:
Api { status: 422, response: ApiError { error: "Cannot attach files that have not finished processing. Try again in a moment!", error_description: None } }
According to the API /media
docs.
202: Accepted
MediaAttachment was created successfully, but the full-size file is still processing. Note that the MediaAttachment’s
url
will still be null, as the media is still being processed in the background. However, thepreview_url
should be available. UseGET /api/v1/media/:id
to check the status of the media attachment.
Checking if an attachment has finished processing is impossible for now. I suggest:
-
Make
Mastodon::media
method returns anenum
to indicate if it is still being processing. -
Add a new method
Mastodon::check_media_status
to check if a media is finished processing. -
Add a new method
Mastodon::upload_media
(maybe another better name) to wrap the wait process, it receives a timeout value from users.