Merge pull request #862 from jodal/fix/clear-current-track

core: Remove clear_current_track argument from stop()
This commit is contained in:
Thomas Adamcik 2014-09-23 19:54:59 +02:00
commit a16cac2188
2 changed files with 14 additions and 13 deletions

View File

@ -8,6 +8,12 @@ This changelog is used to track all major changes to Mopidy.
v0.20.0 (UNRELEASED)
====================
**Core API**
- Removed ``clear_current_track`` keyword argument to
:meth:`mopidy.core.Playback.stop`. It was a leaky internal abstraction,
which was never intended to be used externally.
**Commands**
- Make the ``mopidy`` command print a friendly error message if the

View File

@ -163,7 +163,8 @@ class PlaybackController(object):
if next_tl_track:
self.change_track(next_tl_track)
else:
self.stop(clear_current_track=True)
self.stop()
self.current_tl_track = None
self.core.tracklist.mark_played(original_tl_track)
@ -174,7 +175,8 @@ class PlaybackController(object):
Used by :class:`mopidy.core.TracklistController`.
"""
if self.current_tl_track not in self.core.tracklist.tl_tracks:
self.stop(clear_current_track=True)
self.stop()
self.current_tl_track = None
def next(self):
"""
@ -190,7 +192,8 @@ class PlaybackController(object):
# wait for state change?
self.change_track(tl_track)
else:
self.stop(clear_current_track=True)
self.stop()
self.current_tl_track = None
def pause(self):
"""Pause playback."""
@ -315,22 +318,14 @@ class PlaybackController(object):
self._trigger_seeked(time_position)
return success
def stop(self, clear_current_track=False):
"""
Stop playing.
:param clear_current_track: whether to clear the current track _after_
stopping
:type clear_current_track: boolean
"""
def stop(self):
"""Stop playing."""
if self.state != PlaybackState.STOPPED:
backend = self._get_backend()
time_position_before_stop = self.time_position
if not backend or backend.playback.stop().get():
self.state = PlaybackState.STOPPED
self._trigger_track_playback_ended(time_position_before_stop)
if clear_current_track:
self.current_tl_track = None
def _trigger_track_playback_paused(self):
logger.debug('Triggering track playback paused event')