diff --git a/beetsplug/bpd/__init__.py b/beetsplug/bpd/__init__.py index c43d24fd5..9b21fae9d 100644 --- a/beetsplug/bpd/__init__.py +++ b/beetsplug/bpd/__init__.py @@ -569,7 +569,7 @@ class BaseServer(object): """Begin playback, possibly at a specified playlist index.""" index = cast_arg(int, index) - if index < -1 or index > len(self.playlist): + if index < -1 or index >= len(self.playlist): raise ArgumentIndexError() if index == -1: # No index specified: start where we are. diff --git a/test/test_player.py b/test/test_player.py index 7707a825c..5e196debd 100644 --- a/test/test_player.py +++ b/test/test_player.py @@ -525,14 +525,17 @@ class BPDControlTest(BPDTestHelper): def test_cmd_play(self): with self.run_bpd() as client: - self._bpd_add(client, self.item1) + self._bpd_add(client, self.item1, self.item2) responses = client.send_commands( ('status',), ('play',), - ('status',)) + ('status',), + ('play', '1'), + ('currentsong',)) self._assert_ok(*responses) self.assertEqual('stop', responses[0].data['state']) self.assertEqual('play', responses[2].data['state']) + self.assertEqual('2', responses[4].data['Id']) def test_cmd_next(self): with self.run_bpd() as client: