diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 9660e4e..f511279 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -340,13 +340,13 @@ class Controller(object): if "url" in audio_object and audio_object["url"] =="": self.notify(message=_("This file could not be played because it is not allowed in your country")) return - call_threaded(player.player.play, audio_object, fresh=True) + pub.sendMessage("play", object=audio_object, fresh=True) def play_audios(self, audios): """ Play all audios passed in alist, putting the audio in a queue of the media player. @audios list: A list of Vk audio objects. """ - player.player.play_all(audios, shuffle=self.window.player_shuffle.IsChecked()) + pub.sendMessage("play_all", list_of_songs=audios, shuffle=self.window.player_shuffle.IsChecked()) def view_post(self, post_object, controller_): """ Display the passed post in the passed post presenter. diff --git a/src/presenters/player.py b/src/presenters/player.py index 344320e..8a4c332 100644 --- a/src/presenters/player.py +++ b/src/presenters/player.py @@ -45,6 +45,12 @@ class audioPlayer(object): bassconfig = BassConfig() # Set timeout connection to 30 seconds. bassconfig["net_timeout"] = 30000 + pub.subscribe(self.play, "play") + pub.subscribe(self.play_all, "play_all") + pub.subscribe(self.pause, "pause") + pub.subscribe(self.stop, "stop") + pub.subscribe(self.play_next, "play_next") + pub.subscribe(self.play_previous, "play_previous") def play(self, object, set_info=True, fresh=False): """ Play an URl Stream.