Fix MPD volume command.

The command should return -1 when the volume is not known.
This commit is contained in:
Thomas Adamcik 2012-09-01 22:07:15 +02:00
parent 5a0199ac20
commit f6b96680ae
2 changed files with 4 additions and 4 deletions

View File

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

View File

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