From abe3d67bc11e1b28d13324c0645d3c3a8a3d86d8 Mon Sep 17 00:00:00 2001 From: Jens Luetjen Date: Sat, 9 Jan 2016 12:07:49 +0100 Subject: [PATCH] Some smaller fixes. - Limit config core.restore_state to a known set of values. - Initialize new_state to None instead of '' --- mopidy/config/__init__.py | 3 ++- mopidy/core/playback.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/config/__init__.py b/mopidy/config/__init__.py index e89f0eb9..7d5b300b 100644 --- a/mopidy/config/__init__.py +++ b/mopidy/config/__init__.py @@ -21,7 +21,8 @@ _core_schema['config_dir'] = Path() _core_schema['data_dir'] = Path() # MPD supports at most 10k tracks, some clients segfault when this is exceeded. _core_schema['max_tracklist_length'] = Integer(minimum=1, maximum=10000) -_core_schema['restore_state'] = String(optional=True) +_core_schema['restore_state'] = String( + optional=True, choices=['off', 'volume', 'load', 'last', 'play']) _logging_schema = ConfigSchema('logging') _logging_schema['color'] = Boolean() diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index 1779ed77..f06fb64c 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -554,7 +554,7 @@ class PlaybackController(object): if state: if not isinstance(state, models.PlaybackState): raise TypeError('Expect an argument of type "PlaybackState"') - new_state = '' + new_state = None if 'play-always' in coverage: new_state = PlaybackState.PLAYING if 'play-last' in coverage: