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.
This commit is contained in:
Thomas Adamcik 2012-11-08 23:41:39 +01:00
parent 2a391f23e1
commit 1f544038b0
2 changed files with 11 additions and 2 deletions

View File

@ -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')

View File

@ -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)