Fix MPD volume command.
The command should return -1 when the volume is not known.
This commit is contained in:
parent
5a0199ac20
commit
f6b96680ae
@ -137,7 +137,7 @@ def status(context):
|
||||
|
||||
Reports the current status of the player and the volume level.
|
||||
|
||||
- ``volume``: 0-100
|
||||
- ``volume``: 0-100 or -1
|
||||
- ``repeat``: 0 or 1
|
||||
- ``single``: 0 or 1
|
||||
- ``consume``: 0 or 1
|
||||
@ -267,7 +267,7 @@ def _status_volume(futures):
|
||||
if volume is not None:
|
||||
return volume
|
||||
else:
|
||||
return 0
|
||||
return -1
|
||||
|
||||
def _status_xfade(futures):
|
||||
return 0 # Not supported
|
||||
|
||||
@ -42,10 +42,10 @@ class StatusHandlerTest(unittest.TestCase):
|
||||
self.assert_('playtime' in result)
|
||||
self.assert_(int(result['playtime']) >= 0)
|
||||
|
||||
def test_status_method_contains_volume_which_defaults_to_0(self):
|
||||
def test_status_method_contains_volume_with_na_value(self):
|
||||
result = dict(status.status(self.context))
|
||||
self.assert_('volume' in result)
|
||||
self.assertEqual(int(result['volume']), 0)
|
||||
self.assertEqual(int(result['volume']), -1)
|
||||
|
||||
def test_status_method_contains_volume(self):
|
||||
self.mixer.volume = 17
|
||||
|
||||
Loading…
Reference in New Issue
Block a user