Removed unneeded code and fixed small typos

This commit is contained in:
2022-11-20 14:54:10 -06:00
parent e42bd85274
commit 8850e5fdde
3 changed files with 4 additions and 4 deletions

View File

@@ -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):

View File

@@ -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":