diff --git a/docs/changelog.rst b/docs/changelog.rst index 4dce587c..7761d8ea 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -13,6 +13,9 @@ Bug fix release. - Core/MPD/Local: Add support for ``title`` in :meth:`mopidy.core.LibraryController.get_distinct`. (Fixes: :issue:`1181`) +- Core: Make sure track changes make it to audio while paused. + (Fixes: :issuse:`1177`) + v1.0.5 (2015-05-19) =================== diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index 61bbc60c..d13ebdb3 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -198,6 +198,12 @@ class PlaybackController(object): if old_state == PlaybackState.PLAYING: self._play(on_error_step=on_error_step) elif old_state == PlaybackState.PAUSED: + # NOTE: this is just a quick hack to fix #1177 as this code has + # already been killed in the gapless branch. + backend = self._get_backend() + if backend: + backend.playback.prepare_change() + backend.playback.change_track(tl_track.track).get() self.pause() # TODO: this is not really end of track, this is on_need_next_track diff --git a/tests/core/test_playback.py b/tests/core/test_playback.py index 7c4db0d6..7f395c47 100644 --- a/tests/core/test_playback.py +++ b/tests/core/test_playback.py @@ -668,3 +668,27 @@ class CorePlaybackWithOldBackendTest(unittest.TestCase): c = core.Core(mixer=None, backends=[b]) c.tracklist.add([Track(uri='dummy1:a', length=40000)]) c.playback.play() # No TypeError == test passed. + b.playback.play.assert_called_once_with() + + +class Bug1177RegressionTest(unittest.TestCase): + def test(self): + b = mock.Mock() + b.uri_schemes.get.return_value = ['dummy'] + b.playback = mock.Mock(spec=backend.PlaybackProvider) + b.playback.change_track.return_value.get.return_value = True + b.playback.play.return_value.get.return_value = True + + track1 = Track(uri='dummy:a', length=40000) + track2 = Track(uri='dummy:b', length=40000) + + c = core.Core(mixer=None, backends=[b]) + c.tracklist.add([track1, track2]) + + c.playback.play() + b.playback.change_track.assert_called_once_with(track1) + b.playback.change_track.reset_mock() + + c.playback.pause() + c.playback.next() + b.playback.change_track.assert_called_once_with(track2)