From 8850e5fddeaa626275e9c57fa58a23367f3aad6b Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sun, 20 Nov 2022 14:54:10 -0600 Subject: [PATCH] Removed unneeded code and fixed small typos --- src/controller/mainController.py | 3 +-- src/sessions/mastodon/streaming.py | 1 - src/sessions/mastodon/utils.py | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 3c913261..b60e2e42 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1247,10 +1247,9 @@ class Controller(object): def mastodon_new_conversation(self, conversation, session_name): buffer = self.search_buffer("direct_messages", session_name) if buffer == None: - print("Buffer not found.") + log.error("Buffer not found: direct_messages on {}".format(session_name)) return # Direct messages buffer is hidden new_position, number_of_items = buffer.order_buffer([conversation]) - print(new_position, number_of_items) buffer.put_items_on_list(number_of_items) if new_position > -1: buffer.buffer.list.select_item(new_position) diff --git a/src/sessions/mastodon/streaming.py b/src/sessions/mastodon/streaming.py index c01f993d..91461a65 100644 --- a/src/sessions/mastodon/streaming.py +++ b/src/sessions/mastodon/streaming.py @@ -13,7 +13,6 @@ class StreamListener(mastodon.StreamListener): pub.sendMessage("mastodon.status_received", status=status, session_name=self.session_name) def on_conversation(self, conversation): - print("New conversation: {}".format(conversation)) pub.sendMessage("mastodon.conversation_received", conversation=conversation, session_name=self.session_name) def on_notification(self, notification): diff --git a/src/sessions/mastodon/utils.py b/src/sessions/mastodon/utils.py index 2ea6b57a..b54923f7 100644 --- a/src/sessions/mastodon/utils.py +++ b/src/sessions/mastodon/utils.py @@ -35,13 +35,15 @@ def is_audio_or_video(post): def is_image(post): if post.reblog != None: - return is_audio_or_video(post.reblog) + return is_image(post.reblog) # Checks firstly for Mastodon native videos and audios. for media in post.media_attachments: if media["type"] == "gifv" or media["type"] == "image": return True def get_media_urls(post): + if hasattr(post, "reblog") and post.reblog != None: + return get_media_urls(post.reblog) urls = [] for media in post.media_attachments: if media.get("type") == "audio" or media.get("type") == "video":