Implement _playback_single and add 'single' field to BasePlaybackController
This commit is contained in:
parent
2d2e7c2488
commit
04ceb83c94
@ -249,6 +249,12 @@ class BasePlaybackController(object):
|
||||
#: The current track is played once.
|
||||
repeat = False
|
||||
|
||||
#: :class:`True`
|
||||
#: Playback is stopped after current song, unless in repeat mode.
|
||||
#: :class:`False`
|
||||
#: Playback continues after current song.
|
||||
single = False
|
||||
|
||||
def __init__(self, backend, mixer=alsaaudio.Mixer):
|
||||
self.backend = backend
|
||||
self._state = self.STOPPED
|
||||
|
||||
@ -888,11 +888,10 @@ class MpdHandler(object):
|
||||
single is activated, playback is stopped after current song, or
|
||||
song is repeated if the ``repeat`` mode is enabled.
|
||||
"""
|
||||
state = int(state)
|
||||
if state:
|
||||
raise MpdNotImplemented # TODO
|
||||
if int(state):
|
||||
self.backend.playback.single = True
|
||||
else:
|
||||
raise MpdNotImplemented # TODO
|
||||
self.backend.playback.single = False
|
||||
|
||||
@handle_pattern(r'^stop$')
|
||||
def _playback_stop(self):
|
||||
|
||||
@ -371,11 +371,13 @@ class PlaybackOptionsHandlerTest(unittest.TestCase):
|
||||
|
||||
def test_single_off(self):
|
||||
result = self.h.handle_request(u'single "0"')
|
||||
self.assert_(u'ACK Not implemented' in result)
|
||||
self.assertFalse(self.b.playback.single)
|
||||
self.assert_(u'OK' in result)
|
||||
|
||||
def test_single_on(self):
|
||||
result = self.h.handle_request(u'single "1"')
|
||||
self.assert_(u'ACK Not implemented' in result)
|
||||
self.assertTrue(self.b.playback.single)
|
||||
self.assert_(u'OK' in result)
|
||||
|
||||
def test_replay_gain_mode_off(self):
|
||||
result = self.h.handle_request(u'replay_gain_mode "off"')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user