Fix some issues introduced in the last player stuff

This commit is contained in:
Manuel Cortez 2019-04-11 15:52:18 -05:00
parent 2b42c64160
commit 3d765dd701

View File

@ -328,7 +328,7 @@ class baseBuffer(object):
if post == None: if post == None:
return return
if "type" in post and post["type"] == "audio": if "type" in post and post["type"] == "audio":
pub.sendMessage("play-audio", audio_object=post["audio"]["items"][0]) pub.sendMessage("play-audio", object=post["audio"]["items"][0])
return True return True
def open_person_profile(self, *args, **kwargs): def open_person_profile(self, *args, **kwargs):
@ -357,7 +357,7 @@ class baseBuffer(object):
def pause_audio(self, *args, **kwargs): def pause_audio(self, *args, **kwargs):
""" pauses audio playback.""" """ pauses audio playback."""
player.player.pause() pub.sendMessage("pause")
def remove_buffer(self, mandatory): def remove_buffer(self, mandatory):
""" Function for removing a buffer. Returns True if removal is successful, False otherwise""" """ Function for removing a buffer. Returns True if removal is successful, False otherwise"""
@ -601,7 +601,7 @@ class audioBuffer(feedBuffer):
selected = self.tab.list.get_selected() selected = self.tab.list.get_selected()
if selected == -1: if selected == -1:
selected = 0 selected = 0
pub.sendMessage("play-audio", audio_object=self.session.db[self.name]["items"][selected]) pub.sendMessage("play-audio", object=self.session.db[self.name]["items"][selected])
return True return True
def play_next(self, *args, **kwargs): def play_next(self, *args, **kwargs):
@ -1138,7 +1138,7 @@ class chatBuffer(baseBuffer):
elif attachment["type"] == "audio_message": elif attachment["type"] == "audio_message":
link = attachment["audio_message"]["link_mp3"] link = attachment["audio_message"]["link_mp3"]
output.speak(_("Playing...")) output.speak(_("Playing..."))
player.player.play(url=dict(url=link), set_info=False) pub.sendMessage("play", object=dict(url=link), set_info=False)
elif attachment["type"] == "link": elif attachment["type"] == "link":
output.speak(_("Opening URL..."), True) output.speak(_("Opening URL..."), True)
webbrowser.open_new_tab(attachment["link"]["url"]) webbrowser.open_new_tab(attachment["link"]["url"])