Reworked if conditions in _load_state

This commit is contained in:
Jens Luetjen 2016-04-02 17:12:31 +02:00
parent 4693fa7f8e
commit 100d7dba7b
3 changed files with 12 additions and 18 deletions

View File

@ -73,6 +73,5 @@ class HistoryController(object):
return HistoryState(history=history_list)
def _load_state(self, state, coverage):
if state:
if 'history' in coverage:
if state and 'history' in coverage:
self._history = [(h.timestamp, h.track) for h in state.history]

View File

@ -106,8 +106,7 @@ class MixerController(object):
mute=self.get_mute())
def _load_state(self, state, coverage):
if state:
if 'mixer' in coverage:
if state and 'mixer' in coverage:
self.set_mute(state.mute)
if state.volume:
self.set_volume(state.volume)
self.set_mute(state.mute)

View File

@ -606,13 +606,9 @@ class PlaybackController(object):
state=self.get_state())
def _load_state(self, state, coverage):
if state:
new_state = None
if 'play-last' in coverage:
new_state = state.state
if state.tlid is not None:
if new_state == PlaybackState.PAUSED:
if state and 'play-last' in coverage and state.tlid is not None:
if state.state == PlaybackState.PAUSED:
self._start_paused = True
if new_state in (PlaybackState.PLAYING, PlaybackState.PAUSED):
if state.state in (PlaybackState.PLAYING, PlaybackState.PAUSED):
self._start_at_position = state.time_position
self.play(tlid=state.tlid)