Merge branch 'feature/event-listeners' into feature/mpris-frontend

Conflicts:
	mopidy/backends/base/playback.py
	tests/backends/events_test.py
This commit is contained in:
Stein Magnus Jodal 2011-06-29 19:02:15 +03:00
commit d5913b3a87
5 changed files with 47 additions and 13 deletions

View File

@ -8,6 +8,10 @@ This change log is used to track all major changes to Mopidy.
v0.6.0 (in development)
=======================
**Important changes**
- Pykka 0.12.3 or greater is required.
**Changes**
- Replace :attr:`mopidy.backends.base.Backend.uri_handlers` with

View File

@ -25,7 +25,7 @@ Otherwise, make sure you got the required dependencies installed.
- Python >= 2.6, < 3
- `Pykka <http://jodal.github.com/pykka/>`_ >= 0.12
- `Pykka <http://jodal.github.com/pykka/>`_ >= 0.12.3
- GStreamer >= 0.10, with Python bindings. See :doc:`gstreamer`.

View File

@ -487,32 +487,58 @@ class PlaybackController(object):
self.current_cp_track = None
def _trigger_paused_playing_event(self):
logger.debug(u'Triggering paused playing event')
if self.current_track is None:
return
for listener_ref in ActorRegistry.get_by_class(BackendListener):
listener_ref.proxy().paused_playing(
track=self.current_track, time_position=self.time_position)
ActorRegistry.broadcast({
'command': 'pykka_call',
'attr_path': ('paused_playing',),
'args': [],
'kwargs': {
'track': self.current_track,
'time_position': self.time_position,
},
}, target_class=BackendListener)
def _trigger_resumed_playing_event(self):
logger.debug(u'Triggering resumed playing event')
if self.current_track is None:
return
for listener_ref in ActorRegistry.get_by_class(BackendListener):
listener_ref.proxy().resumed_playing(
track=self.current_track, time_position=self.time_position)
ActorRegistry.broadcast({
'command': 'pykka_call',
'attr_path': ('resumed_playing',),
'args': [],
'kwargs': {
'track': self.current_track,
'time_position': self.time_position,
},
}, target_class=BackendListener)
def _trigger_started_playing_event(self):
logger.debug(u'Triggering started playing event')
if self.current_track is None:
return
for listener_ref in ActorRegistry.get_by_class(BackendListener):
listener_ref.proxy().started_playing(track=self.current_track)
ActorRegistry.broadcast({
'command': 'pykka_call',
'attr_path': ('started_playing',),
'args': [],
'kwargs': {'track': self.current_track},
}, target_class=BackendListener)
def _trigger_stopped_playing_event(self):
# TODO Test that this is called on next/prev/end-of-track
logger.debug(u'Triggering stopped playing event')
if self.current_track is None:
return
for listener_ref in ActorRegistry.get_by_class(BackendListener):
listener_ref.proxy().stopped_playing(
track=self.current_track, time_position=self.time_position)
ActorRegistry.broadcast({
'command': 'pykka_call',
'attr_path': ('stopped_playing',),
'args': [],
'kwargs': {
'track': self.current_track,
'time_position': self.time_position,
},
}, target_class=BackendListener)
class BasePlaybackProvider(object):

View File

@ -108,6 +108,7 @@ class MprisFrontend(ThreadingActor, BackendListener):
logger.debug(u'Startup notification was not sent (%s)', e)
def paused_playing(self, track, time_position):
logger.debug(u'Received paused playing event')
if self.mpris_object is None:
return
self.mpris_object.PropertiesChanged(PLAYER_IFACE, {
@ -116,6 +117,7 @@ class MprisFrontend(ThreadingActor, BackendListener):
}, [])
def resumed_playing(self, track, time_position):
logger.debug(u'Received resumed playing event')
if self.mpris_object is None:
return
self.mpris_object.PropertiesChanged(PLAYER_IFACE, {
@ -124,6 +126,7 @@ class MprisFrontend(ThreadingActor, BackendListener):
}, [])
def started_playing(self, track):
logger.debug(u'Received started playing event')
if self.mpris_object is None:
return
self.mpris_object.PropertiesChanged(PLAYER_IFACE, {
@ -133,6 +136,7 @@ class MprisFrontend(ThreadingActor, BackendListener):
}, [])
def stopped_playing(self, track, time_position):
logger.debug(u'Received stopped playing event')
if self.mpris_object is None:
return
self.mpris_object.PropertiesChanged(PLAYER_IFACE, {

View File

@ -1 +1 @@
Pykka >= 0.12
Pykka >= 0.12.3