MPD: Support missing quotes for 'consume', 'random', 'repeat', and
'single' to work with BitMPC.
This commit is contained in:
parent
9f71c1533a
commit
635791cf0e
@ -25,8 +25,8 @@ Another great release.
|
|||||||
- Fixed ``play "-1"`` and ``playid "-1"`` behaviour when playlist is empty.
|
- Fixed ``play "-1"`` and ``playid "-1"`` behaviour when playlist is empty.
|
||||||
- Support ``plchanges "-1"`` to work better with MPDroid.
|
- Support ``plchanges "-1"`` to work better with MPDroid.
|
||||||
- Support ``pause`` without arguments to work better with MPDroid.
|
- Support ``pause`` without arguments to work better with MPDroid.
|
||||||
- Support ``plchanges`` without quotes to work better with BitMPC.
|
- Support ``plchanges``, ``play``, ``consume``, ``random``, ``repeat``, and
|
||||||
- Support ``play`` without quotes to work better with BitMPC.
|
``single`` without quotes to work better with BitMPC.
|
||||||
|
|
||||||
- Backend API:
|
- Backend API:
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from mopidy.frontends.mpd import (handle_pattern, MpdArgError, MpdNoExistError,
|
from mopidy.frontends.mpd import (handle_pattern, MpdArgError, MpdNoExistError,
|
||||||
MpdNotImplemented)
|
MpdNotImplemented)
|
||||||
|
|
||||||
|
@handle_pattern(r'^consume (?P<state>[01])$')
|
||||||
@handle_pattern(r'^consume "(?P<state>[01])"$')
|
@handle_pattern(r'^consume "(?P<state>[01])"$')
|
||||||
def consume(frontend, state):
|
def consume(frontend, state):
|
||||||
"""
|
"""
|
||||||
@ -224,6 +225,7 @@ def previous(frontend):
|
|||||||
"""
|
"""
|
||||||
return frontend.backend.playback.previous()
|
return frontend.backend.playback.previous()
|
||||||
|
|
||||||
|
@handle_pattern(r'^random (?P<state>[01])$')
|
||||||
@handle_pattern(r'^random "(?P<state>[01])"$')
|
@handle_pattern(r'^random "(?P<state>[01])"$')
|
||||||
def random(frontend, state):
|
def random(frontend, state):
|
||||||
"""
|
"""
|
||||||
@ -238,6 +240,7 @@ def random(frontend, state):
|
|||||||
else:
|
else:
|
||||||
frontend.backend.playback.random = False
|
frontend.backend.playback.random = False
|
||||||
|
|
||||||
|
@handle_pattern(r'^repeat (?P<state>[01])$')
|
||||||
@handle_pattern(r'^repeat "(?P<state>[01])"$')
|
@handle_pattern(r'^repeat "(?P<state>[01])"$')
|
||||||
def repeat(frontend, state):
|
def repeat(frontend, state):
|
||||||
"""
|
"""
|
||||||
@ -319,6 +322,7 @@ def setvol(frontend, volume):
|
|||||||
volume = 100
|
volume = 100
|
||||||
frontend.backend.mixer.volume = volume
|
frontend.backend.mixer.volume = volume
|
||||||
|
|
||||||
|
@handle_pattern(r'^single (?P<state>[01])$')
|
||||||
@handle_pattern(r'^single "(?P<state>[01])"$')
|
@handle_pattern(r'^single "(?P<state>[01])"$')
|
||||||
def single(frontend, state):
|
def single(frontend, state):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -16,11 +16,21 @@ class PlaybackOptionsHandlerTest(unittest.TestCase):
|
|||||||
self.assertFalse(self.b.playback.consume)
|
self.assertFalse(self.b.playback.consume)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_consume_off_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'consume 0')
|
||||||
|
self.assertFalse(self.b.playback.consume)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_consume_on(self):
|
def test_consume_on(self):
|
||||||
result = self.h.handle_request(u'consume "1"')
|
result = self.h.handle_request(u'consume "1"')
|
||||||
self.assertTrue(self.b.playback.consume)
|
self.assertTrue(self.b.playback.consume)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_consume_on_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'consume 1')
|
||||||
|
self.assertTrue(self.b.playback.consume)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_crossfade(self):
|
def test_crossfade(self):
|
||||||
result = self.h.handle_request(u'crossfade "10"')
|
result = self.h.handle_request(u'crossfade "10"')
|
||||||
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
||||||
@ -30,21 +40,41 @@ class PlaybackOptionsHandlerTest(unittest.TestCase):
|
|||||||
self.assertFalse(self.b.playback.random)
|
self.assertFalse(self.b.playback.random)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_random_off_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'random 0')
|
||||||
|
self.assertFalse(self.b.playback.random)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_random_on(self):
|
def test_random_on(self):
|
||||||
result = self.h.handle_request(u'random "1"')
|
result = self.h.handle_request(u'random "1"')
|
||||||
self.assertTrue(self.b.playback.random)
|
self.assertTrue(self.b.playback.random)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_random_on_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'random 1')
|
||||||
|
self.assertTrue(self.b.playback.random)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_repeat_off(self):
|
def test_repeat_off(self):
|
||||||
result = self.h.handle_request(u'repeat "0"')
|
result = self.h.handle_request(u'repeat "0"')
|
||||||
self.assertFalse(self.b.playback.repeat)
|
self.assertFalse(self.b.playback.repeat)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_repeat_off_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'repeat 0')
|
||||||
|
self.assertFalse(self.b.playback.repeat)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_repeat_on(self):
|
def test_repeat_on(self):
|
||||||
result = self.h.handle_request(u'repeat "1"')
|
result = self.h.handle_request(u'repeat "1"')
|
||||||
self.assertTrue(self.b.playback.repeat)
|
self.assertTrue(self.b.playback.repeat)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_repeat_on_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'repeat 1')
|
||||||
|
self.assertTrue(self.b.playback.repeat)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_setvol_below_min(self):
|
def test_setvol_below_min(self):
|
||||||
result = self.h.handle_request(u'setvol "-10"')
|
result = self.h.handle_request(u'setvol "-10"')
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
@ -80,11 +110,21 @@ class PlaybackOptionsHandlerTest(unittest.TestCase):
|
|||||||
self.assertFalse(self.b.playback.single)
|
self.assertFalse(self.b.playback.single)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_single_off_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'single 0')
|
||||||
|
self.assertFalse(self.b.playback.single)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_single_on(self):
|
def test_single_on(self):
|
||||||
result = self.h.handle_request(u'single "1"')
|
result = self.h.handle_request(u'single "1"')
|
||||||
self.assertTrue(self.b.playback.single)
|
self.assertTrue(self.b.playback.single)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
|
def test_single_on_without_quotes(self):
|
||||||
|
result = self.h.handle_request(u'single 1')
|
||||||
|
self.assertTrue(self.b.playback.single)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_replay_gain_mode_off(self):
|
def test_replay_gain_mode_off(self):
|
||||||
result = self.h.handle_request(u'replay_gain_mode "off"')
|
result = self.h.handle_request(u'replay_gain_mode "off"')
|
||||||
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user