From f6b96680ae849d87510a6d52faa348084bffdb3a Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 1 Sep 2012 22:07:15 +0200 Subject: [PATCH] Fix MPD volume command. The command should return -1 when the volume is not known. --- mopidy/frontends/mpd/protocol/status.py | 4 ++-- tests/frontends/mpd/status_test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mopidy/frontends/mpd/protocol/status.py b/mopidy/frontends/mpd/protocol/status.py index f32c46c8..81b68dd6 100644 --- a/mopidy/frontends/mpd/protocol/status.py +++ b/mopidy/frontends/mpd/protocol/status.py @@ -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 diff --git a/tests/frontends/mpd/status_test.py b/tests/frontends/mpd/status_test.py index bdd2dab8..9fa62321 100644 --- a/tests/frontends/mpd/status_test.py +++ b/tests/frontends/mpd/status_test.py @@ -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