Skip to content

Commit

Permalink
Pause spotify playback when Mopidy paused. (Fixes #146)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingosticks committed Oct 10, 2017
1 parent 5c49369 commit 68512f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mopidy_spotify/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def stop(self):
self.backend._session.player.pause()
return super(SpotifyPlaybackProvider, self).stop()

def pause(self):
logger.debug('Audio requested pause; pausing Spotify player')
self.backend._session.player.pause()
return super(SpotifyPlaybackProvider, self).pause()

def on_seek_data(self, time_position):
logger.debug('Audio requested seek to %d', time_position)

Expand Down
6 changes: 6 additions & 0 deletions tests/test_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def test_stop_pauses_spotify_playback(session_mock, provider):
session_mock.player.pause.assert_called_once_with()


def test_pause_pauses_spotify_playback(session_mock, provider):
provider.pause()

session_mock.player.pause.assert_called_once_with()


def test_on_seek_data_updates_timestamp_and_seeks_in_spotify(
session_mock, provider):
provider.on_seek_data(1780)
Expand Down

0 comments on commit 68512f6

Please sign in to comment.