Fix volume setting for Droid MPD

This commit is contained in:
Stein Magnus Jodal 2011-01-09 23:38:46 +01:00
parent a14f114d2a
commit 469e5fa189
3 changed files with 15 additions and 0 deletions

View File

@ -54,6 +54,11 @@ No description yet.
application menus.
- Create infrastructure for creating Debian packages of Mopidy.
- MPD frontend:
- Support ``setvol 50`` without quotes around the argument. Fixes volume
control in Droid MPD.
- Local backend:
- Add :command:`mopidy-scan` command to generate ``tag_cache`` files without

View File

@ -320,6 +320,7 @@ def seekid(frontend, cpid, seconds):
playid(frontend, cpid)
frontend.backend.playback.seek(int(seconds) * 1000)
@handle_pattern(r'^setvol (?P<volume>[-+]*\d+)$')
@handle_pattern(r'^setvol "(?P<volume>[-+]*\d+)"$')
def setvol(frontend, volume):
"""
@ -328,6 +329,10 @@ def setvol(frontend, volume):
``setvol {VOL}``
Sets volume to ``VOL``, the range of volume is 0-100.
*Droid MPD:*
- issues ``setvol 50`` without quotes around the argument.
"""
volume = int(volume)
if volume < 0:

View File

@ -104,6 +104,11 @@ class PlaybackOptionsHandlerTest(unittest.TestCase):
self.assert_(u'OK' in result)
self.assertEqual(10, self.b.mixer.volume)
def test_setvol_without_quotes(self):
result = self.h.handle_request(u'setvol 50')
self.assert_(u'OK' in result)
self.assertEqual(50, self.b.mixer.volume)
def test_single_off(self):
result = self.h.handle_request(u'single "0"')
self.assertFalse(self.b.playback.single)