From e67cf3805a7e7642fb1867960c345c158b287ab6 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 24 Aug 2010 02:56:20 +0200 Subject: [PATCH] Issue events from backend to frontend on 'now_playing' and 'end_of_track' --- mopidy/backends/base/playback.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mopidy/backends/base/playback.py b/mopidy/backends/base/playback.py index df588f39..67a86a28 100644 --- a/mopidy/backends/base/playback.py +++ b/mopidy/backends/base/playback.py @@ -323,6 +323,13 @@ class BasePlaybackController(object): if self.consume: self.backend.current_playlist.remove(cpid=original_cp_track[0]) + # Notify frontends of the end_of_track event + self.backend.core_queue.put({ + 'to': 'frontend', + 'command': 'end_of_track', + 'track': original_cp_track[1], + }) + def on_current_playlist_change(self): """ Tell the playback controller that the current playlist has changed. @@ -400,6 +407,13 @@ class BasePlaybackController(object): if self.random and self.current_cp_track in self._shuffled: self._shuffled.remove(self.current_cp_track) + # Notify frontends of the now_playing event + self.backend.core_queue.put({ + 'to': 'frontend', + 'command': 'now_playing', + 'track': cp_track[1], + }) + def _play(self, track): """ To be overridden by subclass. Implement your backend's play