From 1f544038b046df8bc4652b6547b136acb33077af Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Thu, 8 Nov 2012 23:41:39 +0100 Subject: [PATCH] Setup about to finish handling for proper EOT support. With this change we ask the core.playback system to set the next tracks uri and otherwise update state as needed. With this change we should be able to support streaming oggs and gapless playback to mention a few of items this fixes. On the down side, this change breaks test_end_of_track_skips_to_next_track_on_failure as there is no clean way to handle this with the async nature of this EOT handling. --- mopidy/audio/actor.py | 7 +++++++ mopidy/core/playback.py | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 1f482301..0a0cb0be 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -77,6 +77,13 @@ class Audio(pykka.ThreadingActor): def _on_about_to_finish(self, element): self._appsrc = None + # TODO: this is just a horrible hack to get us started. the + # comunication is correct, but this way of hooking it up is not. + from mopidy.core import Core + logger.debug(u'Triggering reached end of track event') + core = pykka.ActorRegistry.get_by_class(Core)[0].proxy() + core.playback.on_end_of_track().get() + def _on_new_source(self, element, pad): source = element.get_property('source') diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index 73227f68..3ca2631f 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -315,7 +315,7 @@ class PlaybackController(object): def on_end_of_stream(self): self._trigger_track_playback_ended() self.state = PlaybackState.STOPPED - self.current_cp_track = None + self.current_tl_track = None def on_end_of_track(self): """ @@ -329,8 +329,10 @@ class PlaybackController(object): original_tl_track = self.current_tl_track if self.tl_track_at_eot: + self.current_tl_track = self.tl_track_at_eot self._trigger_track_playback_ended() - self.play(self.tl_track_at_eot) + self._get_backend().playback.change_track(self.current_track) + self._trigger_track_playback_started() if self.consume: self.core.tracklist.remove(tlid=original_tl_track.tlid)