Renamed member in HistoryController

- add 'play-always' and 'play-last' to docstring for _load_state.
- renamed _start_at_pos to _start_at_position
- changed 'if const == value:' to 'if value == const:'
- changed info text to 'Limiting history'
This commit is contained in:
Jens Luetjen 2016-03-31 23:17:29 +02:00
parent 67044cecab
commit 01201d142c
3 changed files with 11 additions and 12 deletions

View File

@ -197,7 +197,8 @@ class Core(
- 'tracklist' fill the tracklist
- 'mode' set tracklist properties (consume, random, repeat, single)
- 'autoplay' start playing ('tracklist' also required)
- 'play-last' restore play state ('tracklist' also required)
- 'play-always' start playing ('tracklist' also required)
- 'mixer' set mixer volume and mute state
- 'history' restore history

View File

@ -70,7 +70,7 @@ class HistoryController(object):
timestamp=timestamp, track=track))
count += 1
if count_max < count:
logger.info('Limit history to %s tracks.', count_max)
logger.info('Limiting history to %s tracks.', count_max)
break
return HistoryState(history=history_list)
@ -79,5 +79,4 @@ class HistoryController(object):
if state:
if 'history' in coverage:
self._history = []
for htrack in state.history:
self._history.append((htrack.timestamp, htrack.track))
self._history = [(h.timestamp, h.track) for h in state.history]

View File

@ -29,7 +29,7 @@ class PlaybackController(object):
self._last_position = None
self._previous = False
self._start_at_pos = None
self._start_at_position = None
self._start_paused = False
if self._audio:
@ -229,9 +229,9 @@ class PlaybackController(object):
self.set_state(PlaybackState.PLAYING)
self._trigger_track_playback_started()
seek_ok = False
if self._start_at_pos:
seek_ok = self.seek(self._start_at_pos)
self._start_at_pos = None
if self._start_at_position:
seek_ok = self.seek(self._start_at_position)
self._start_at_position = None
if not seek_ok and self._start_paused:
self.pause()
self._start_paused = False
@ -615,9 +615,8 @@ class PlaybackController(object):
if 'play-last' in coverage:
new_state = state.state
if state.tlid is not None:
if PlaybackState.PAUSED == new_state:
if new_state == PlaybackState.PAUSED:
self._start_paused = True
if (PlaybackState.PLAYING == new_state or
PlaybackState.PAUSED == new_state):
self._start_at_pos = state.position
if new_state in (PlaybackState.PLAYING, PlaybackState.PAUSED):
self._start_at_position = state.position
self.play(tlid=state.tlid)