bpd: support nextsong in status

This commit is contained in:
Carl Suster 2019-04-12 12:30:40 +10:00
parent fdd809fd36
commit dc7e3b9b6a
2 changed files with 7 additions and 1 deletions

View file

@ -412,6 +412,11 @@ class BaseServer(object):
current_id = self._item_id(self.playlist[self.current_index])
yield u'song: ' + six.text_type(self.current_index)
yield u'songid: ' + six.text_type(current_id)
if len(self.playlist) > self.current_index + 1:
# If there's a next song, report its index too.
next_id = self._item_id(self.playlist[self.current_index + 1])
yield u'nextsong: ' + six.text_type(self.current_index + 1)
yield u'nextsongid: ' + six.text_type(next_id)
if self.error:
yield u'error: ' + self.error

View file

@ -433,7 +433,8 @@ class BPDQueryTest(BPDTestHelper):
}
self.assertEqual(fields_not_playing, set(responses[0].data.keys()))
fields_playing = fields_not_playing | {
'song', 'songid', 'time', 'elapsed', 'bitrate', 'duration', 'audio'
'song', 'songid', 'time', 'elapsed', 'bitrate', 'duration',
'audio', 'nextsong', 'nextsongid'
}
self.assertEqual(fields_playing, set(responses[2].data.keys()))