mirror of
https://github.com/beetbox/beets.git
synced 2026-02-24 16:23:04 +01:00
bpd: add dummy command for volume
MPD supports a deprecated command 'volume' which was used to change the volume by a relative amount unlike its replacement 'setvol' which uses an absolute amount. As far as I can tell 'volume' always responds with a system error message "No mixer".
This commit is contained in:
parent
1511e313f7
commit
67a0b38d20
2 changed files with 24 additions and 3 deletions
|
|
@ -356,6 +356,10 @@ class BaseServer(object):
|
|||
raise BPDError(ERROR_ARG, u'volume out of range')
|
||||
self.volume = vol
|
||||
|
||||
def cmd_volume(self, conn, vol_delta):
|
||||
"""Deprecated command to change the volume by a relative amount."""
|
||||
raise BPDError(ERROR_SYSTEM, u'No mixer')
|
||||
|
||||
def cmd_crossfade(self, conn, crossfade):
|
||||
"""Set the number of seconds of crossfading."""
|
||||
crossfade = cast_arg(int, crossfade)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ gstplayer._GstPlayer = mock.MagicMock(
|
|||
"seek"
|
||||
], **{
|
||||
'playing': False,
|
||||
'volume': 0.0,
|
||||
'volume': 0,
|
||||
'time.return_value': (0, 0),
|
||||
'play_file.side_effect': _gstplayer_play,
|
||||
})
|
||||
|
|
@ -362,8 +362,8 @@ class BPDQueryTest(BPDTestHelper):
|
|||
class BPDPlaybackTest(BPDTestHelper):
|
||||
test_implements_playback = implements({
|
||||
'consume', 'random',
|
||||
'repeat', 'setvol', 'single', 'replay_gain_mode',
|
||||
'replay_gain_status', 'volume',
|
||||
'repeat', 'single', 'replay_gain_mode',
|
||||
'replay_gain_status',
|
||||
}, expectedFailure=True)
|
||||
|
||||
def test_cmd_crossfade(self):
|
||||
|
|
@ -399,6 +399,23 @@ class BPDPlaybackTest(BPDTestHelper):
|
|||
self.assertAlmostEqual(2, float(responses[1].data['mixrampdelay']))
|
||||
self.assertNotIn('mixrampdelay', responses[3].data)
|
||||
|
||||
def test_cmd_setvol(self):
|
||||
with self.run_bpd() as client:
|
||||
responses = client.send_commands(
|
||||
('setvol', '67'),
|
||||
('status',),
|
||||
('setvol', '32'),
|
||||
('status',),
|
||||
('setvol', '101'))
|
||||
self._assert_failed(responses, bpd.ERROR_ARG, pos=4)
|
||||
self.assertEqual('67', responses[1].data['volume'])
|
||||
self.assertEqual('32', responses[3].data['volume'])
|
||||
|
||||
def test_cmd_volume(self):
|
||||
with self.run_bpd() as client:
|
||||
response = client.send_command('volume', '10')
|
||||
self._assert_failed(response, bpd.ERROR_SYSTEM)
|
||||
|
||||
|
||||
class BPDControlTest(BPDTestHelper):
|
||||
test_implements_control = implements({
|
||||
|
|
|
|||
Loading…
Reference in a new issue