Add check for whether to queue the currently playing album (close #78)

Check if the album to be played is currently the same as the last album
in the playlist. If so, this album should not be appended to the playlist,
but instead we should just play the first track from the album.
This commit is contained in:
alix 2020-10-11 17:34:03 +11:00
commit e5b27fc242

View file

@ -603,6 +603,9 @@ class Client(Base):
def _play_album(self, album): def _play_album(self, album):
if self._playlist and album == self._playlist[-1]._id:
track_ids = [self._playlist[-1].get_tracks()[0].get_id()]
else:
track_ids = self._queue_album(album) track_ids = self._queue_album(album)
if track_ids: if track_ids:
self._logger.info("play track %d", track_ids[0]) self._logger.info("play track %d", track_ids[0])