mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Added indications when there are audio, video, photos or gifvs in media attachments
This commit is contained in:
parent
d71d3695eb
commit
c0654658b5
@ -304,13 +304,13 @@ class BaseBuffer(base.Buffer):
|
||||
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at)
|
||||
ts = original_date.humanize(locale=languageHandler.getLanguage())
|
||||
self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts)
|
||||
# if self.session.settings['sound']['indicate_audio'] and utils.is_audio(toot):
|
||||
# self.session.sound.play("audio.ogg")
|
||||
# if self.session.settings['sound']['indicate_img'] and utils.is_media(toot):
|
||||
# self.session.sound.play("image.ogg")
|
||||
if self.session.settings['sound']['indicate_audio'] and utils.is_audio_or_video(toot):
|
||||
self.session.sound.play("audio.ogg")
|
||||
if self.session.settings['sound']['indicate_img'] and utils.is_image(toot):
|
||||
self.session.sound.play("image.ogg")
|
||||
# can_share = self.can_share()
|
||||
# pub.sendMessage("toggleShare", shareable=can_share)
|
||||
# self.buffer.retweet.Enable(can_share)
|
||||
# self.buffer.boost.Enable(can_share)
|
||||
|
||||
def audio(self, url='', *args, **kwargs):
|
||||
if sound.URLPlayer.player.is_playing():
|
||||
|
@ -20,6 +20,8 @@ input_device = string(default="Default")
|
||||
output_device = string(default="Default")
|
||||
session_mute = boolean(default=False)
|
||||
current_soundpack = string(default="default")
|
||||
indicate_audio = boolean(default=True)
|
||||
indicate_img = boolean(default=True)
|
||||
|
||||
[other_buffers]
|
||||
timelines = list(default=list())
|
||||
|
@ -18,3 +18,19 @@ def find_item(item, listItems):
|
||||
if item.reblog != None and item.reblog.id == listItems[i].id:
|
||||
return i
|
||||
return None
|
||||
|
||||
def is_audio_or_video(toot):
|
||||
if toot.reblog != None:
|
||||
return is_audio_or_video(toot.reblog)
|
||||
# Checks firstly for Mastodon native videos and audios.
|
||||
for media in toot.media_attachments:
|
||||
if media["type"] == "video" or media["type"] == "audio":
|
||||
return True
|
||||
|
||||
def is_image(toot):
|
||||
if toot.reblog != None:
|
||||
return is_audio_or_video(toot.reblog)
|
||||
# Checks firstly for Mastodon native videos and audios.
|
||||
for media in toot.media_attachments:
|
||||
if media["type"] == "gifv" or media["type"] == "image":
|
||||
return True
|
Loading…
Reference in New Issue
Block a user