Some smaller fixes.

- Limit config core.restore_state to a known set of values.
- Initialize new_state to None instead of ''
This commit is contained in:
Jens Luetjen 2016-01-09 12:07:49 +01:00
parent 6e99a95aae
commit abe3d67bc1
2 changed files with 3 additions and 2 deletions

View File

@ -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()

View File

@ -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: