mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Removed unneeded code and fixed small typos
This commit is contained in:
parent
e42bd85274
commit
8850e5fdde
@ -1247,10 +1247,9 @@ class Controller(object):
|
|||||||
def mastodon_new_conversation(self, conversation, session_name):
|
def mastodon_new_conversation(self, conversation, session_name):
|
||||||
buffer = self.search_buffer("direct_messages", session_name)
|
buffer = self.search_buffer("direct_messages", session_name)
|
||||||
if buffer == None:
|
if buffer == None:
|
||||||
print("Buffer not found.")
|
log.error("Buffer not found: direct_messages on {}".format(session_name))
|
||||||
return # Direct messages buffer is hidden
|
return # Direct messages buffer is hidden
|
||||||
new_position, number_of_items = buffer.order_buffer([conversation])
|
new_position, number_of_items = buffer.order_buffer([conversation])
|
||||||
print(new_position, number_of_items)
|
|
||||||
buffer.put_items_on_list(number_of_items)
|
buffer.put_items_on_list(number_of_items)
|
||||||
if new_position > -1:
|
if new_position > -1:
|
||||||
buffer.buffer.list.select_item(new_position)
|
buffer.buffer.list.select_item(new_position)
|
||||||
|
@ -13,7 +13,6 @@ class StreamListener(mastodon.StreamListener):
|
|||||||
pub.sendMessage("mastodon.status_received", status=status, session_name=self.session_name)
|
pub.sendMessage("mastodon.status_received", status=status, session_name=self.session_name)
|
||||||
|
|
||||||
def on_conversation(self, conversation):
|
def on_conversation(self, conversation):
|
||||||
print("New conversation: {}".format(conversation))
|
|
||||||
pub.sendMessage("mastodon.conversation_received", conversation=conversation, session_name=self.session_name)
|
pub.sendMessage("mastodon.conversation_received", conversation=conversation, session_name=self.session_name)
|
||||||
|
|
||||||
def on_notification(self, notification):
|
def on_notification(self, notification):
|
||||||
|
@ -35,13 +35,15 @@ def is_audio_or_video(post):
|
|||||||
|
|
||||||
def is_image(post):
|
def is_image(post):
|
||||||
if post.reblog != None:
|
if post.reblog != None:
|
||||||
return is_audio_or_video(post.reblog)
|
return is_image(post.reblog)
|
||||||
# Checks firstly for Mastodon native videos and audios.
|
# Checks firstly for Mastodon native videos and audios.
|
||||||
for media in post.media_attachments:
|
for media in post.media_attachments:
|
||||||
if media["type"] == "gifv" or media["type"] == "image":
|
if media["type"] == "gifv" or media["type"] == "image":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_media_urls(post):
|
def get_media_urls(post):
|
||||||
|
if hasattr(post, "reblog") and post.reblog != None:
|
||||||
|
return get_media_urls(post.reblog)
|
||||||
urls = []
|
urls = []
|
||||||
for media in post.media_attachments:
|
for media in post.media_attachments:
|
||||||
if media.get("type") == "audio" or media.get("type") == "video":
|
if media.get("type") == "audio" or media.get("type") == "video":
|
||||||
|
Loading…
Reference in New Issue
Block a user