mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Mastodon: Allow adding descriptions to all supported media. Closes #516
This commit is contained in:
parent
e9dc02e868
commit
f3fd1087b4
@ -5,6 +5,8 @@ TWBlue Changelog
|
|||||||
We had to release a 2023.2.8 version of TWblue, which removes the API deprecation code as Twitter has changed again their plans, and set their free API shutdown to February 13. This new release will not enforce any date for stopping support to Twitter sessions, but will skip loading the sessions if there are errors when logging into Twitter. There are also some significant improvements to our Mastodon support, which you can read in the following list of changes:
|
We had to release a 2023.2.8 version of TWblue, which removes the API deprecation code as Twitter has changed again their plans, and set their free API shutdown to February 13. This new release will not enforce any date for stopping support to Twitter sessions, but will skip loading the sessions if there are errors when logging into Twitter. There are also some significant improvements to our Mastodon support, which you can read in the following list of changes:
|
||||||
|
|
||||||
* TWBlue should be able to display variables within templates (for example, now it is possible to send a template inside a post's text). Before, it was removing $variables so it was difficult to show how to edit templates from the client. ([#515](https://github.com/MCV-Software/TWBlue/issues/515))
|
* TWBlue should be able to display variables within templates (for example, now it is possible to send a template inside a post's text). Before, it was removing $variables so it was difficult to show how to edit templates from the client. ([#515](https://github.com/MCV-Software/TWBlue/issues/515))
|
||||||
|
* Mastodon:
|
||||||
|
* it is possible to add descriptions for all media available on Mastodon (audio, photos, video and Givs). ([#516](https://github.com/MCV-Software/TWBlue/issues/516))
|
||||||
|
|
||||||
## Changes on version 2023.2.6
|
## Changes on version 2023.2.6
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ class post(messages.basicTweet):
|
|||||||
break
|
break
|
||||||
if can_attach == False or big_media_present == True:
|
if can_attach == False or big_media_present == True:
|
||||||
return self.message.unable_to_attach_file()
|
return self.message.unable_to_attach_file()
|
||||||
video = self.message.get_video()
|
video, description = self.message.get_video()
|
||||||
if video != None:
|
if video != None:
|
||||||
videoInfo = {"type": "video", "file": video, "description": ""}
|
videoInfo = {"type": "video", "file": video, "description": description}
|
||||||
self.attachments.append(videoInfo)
|
self.attachments.append(videoInfo)
|
||||||
self.message.add_item(item=[os.path.basename(videoInfo["file"]), videoInfo["type"], videoInfo["description"]])
|
self.message.add_item(item=[os.path.basename(videoInfo["file"]), videoInfo["type"], videoInfo["description"]])
|
||||||
self.text_processor()
|
self.text_processor()
|
||||||
@ -166,9 +166,9 @@ class post(messages.basicTweet):
|
|||||||
break
|
break
|
||||||
if can_attach == False or big_media_present == True:
|
if can_attach == False or big_media_present == True:
|
||||||
return self.message.unable_to_attach_file()
|
return self.message.unable_to_attach_file()
|
||||||
audio = self.message.get_audio()
|
audio, description = self.message.get_audio()
|
||||||
if audio != None:
|
if audio != None:
|
||||||
audioInfo = {"type": "audio", "file": audio, "description": ""}
|
audioInfo = {"type": "audio", "file": audio, "description": description}
|
||||||
self.attachments.append(audioInfo)
|
self.attachments.append(audioInfo)
|
||||||
self.message.add_item(item=[os.path.basename(audioInfo["file"]), audioInfo["type"], audioInfo["description"]])
|
self.message.add_item(item=[os.path.basename(audioInfo["file"]), audioInfo["type"], audioInfo["description"]])
|
||||||
self.text_processor()
|
self.text_processor()
|
||||||
|
@ -210,8 +210,8 @@ class Session(base.baseSession):
|
|||||||
poll = self.api.make_poll(options=obj["attachments"][0]["options"], expires_in=obj["attachments"][0]["expires_in"], multiple=obj["attachments"][0]["multiple"], hide_totals=obj["attachments"][0]["hide_totals"])
|
poll = self.api.make_poll(options=obj["attachments"][0]["options"], expires_in=obj["attachments"][0]["expires_in"], multiple=obj["attachments"][0]["multiple"], hide_totals=obj["attachments"][0]["hide_totals"])
|
||||||
else:
|
else:
|
||||||
for i in obj["attachments"]:
|
for i in obj["attachments"]:
|
||||||
img = self.api_call("media_post", media_file=i["file"], description=i["description"], synchronous=True)
|
media = self.api_call("media_post", media_file=i["file"], description=i["description"], synchronous=True)
|
||||||
media_ids.append(img.id)
|
media_ids.append(media.id)
|
||||||
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id, media_ids=media_ids, visibility=visibility, poll=poll, sensitive=obj["sensitive"], spoiler_text=obj["spoiler_text"])
|
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id, media_ids=media_ids, visibility=visibility, poll=poll, sensitive=obj["sensitive"], spoiler_text=obj["spoiler_text"])
|
||||||
if item != None:
|
if item != None:
|
||||||
in_reply_to_id = item["id"]
|
in_reply_to_id = item["id"]
|
||||||
|
@ -42,7 +42,7 @@ def process_image_descriptions(media_attachments):
|
|||||||
image_descriptions.append(media.get("description"))
|
image_descriptions.append(media.get("description"))
|
||||||
idescriptions = ""
|
idescriptions = ""
|
||||||
for image in image_descriptions:
|
for image in image_descriptions:
|
||||||
idescriptions = idescriptions + _("Image description: {}").format(image) + "\n"
|
idescriptions = idescriptions + _("Media description: {}").format(image) + "\n"
|
||||||
return idescriptions
|
return idescriptions
|
||||||
|
|
||||||
def render_post(post, template, relative_times=False, offset_hours=0):
|
def render_post(post, template, relative_times=False, offset_hours=0):
|
||||||
|
@ -147,14 +147,16 @@ class Post(wx.Dialog):
|
|||||||
def get_video(self):
|
def get_video(self):
|
||||||
openFileDialog = wx.FileDialog(self, _("Select the video to be uploaded"), "", "", _("Video files (*.mp4, *.mov, *.m4v, *.webm)| *.mp4; *.m4v; *.mov; *.webm"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
openFileDialog = wx.FileDialog(self, _("Select the video to be uploaded"), "", "", _("Video files (*.mp4, *.mov, *.m4v, *.webm)| *.mp4; *.m4v; *.mov; *.webm"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||||
return None
|
return (None, None)
|
||||||
return openFileDialog.GetPath()
|
dsc = self.ask_description()
|
||||||
|
return (openFileDialog.GetPath(), dsc)
|
||||||
|
|
||||||
def get_audio(self):
|
def get_audio(self):
|
||||||
openFileDialog = wx.FileDialog(self, _("Select the audio file to be uploaded"), "", "", _("Audio files (*.mp3, *.ogg, *.wav, *.flac, *.opus, *.aac, *.m4a, *.3gp)|*.mp3; *.ogg; *.wav; *.flac; *.opus; *.aac; *.m4a; *.3gp"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
openFileDialog = wx.FileDialog(self, _("Select the audio file to be uploaded"), "", "", _("Audio files (*.mp3, *.ogg, *.wav, *.flac, *.opus, *.aac, *.m4a, *.3gp)|*.mp3; *.ogg; *.wav; *.flac; *.opus; *.aac; *.m4a; *.3gp"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||||
return None
|
return (None, None)
|
||||||
return openFileDialog.GetPath()
|
dsc = self.ask_description()
|
||||||
|
return (openFileDialog.GetPath(), dsc)
|
||||||
|
|
||||||
def unable_to_attach_file(self, *args, **kwargs):
|
def unable_to_attach_file(self, *args, **kwargs):
|
||||||
return wx.MessageDialog(self, _("It is not possible to add more attachments. Please take into account that You can add only a maximum of 4 images, or one audio, video or poll per post. Please remove other attachments before continuing."), _("Error adding attachment"), wx.ICON_ERROR).ShowModal()
|
return wx.MessageDialog(self, _("It is not possible to add more attachments. Please take into account that You can add only a maximum of 4 images, or one audio, video or poll per post. Please remove other attachments before continuing."), _("Error adding attachment"), wx.ICON_ERROR).ShowModal()
|
||||||
|
Loading…
Reference in New Issue
Block a user