FIX enqueue position when playing track @ pos != 0

fix #6
This commit is contained in:
boyska 2015-05-23 16:23:25 +02:00
parent 0da68e9b9e
commit 69cdb83bd1
No known key found for this signature in database
GPG key ID: 7395DCAE58289CA9

View file

@ -63,8 +63,9 @@ class Player(gevent.Greenlet):
mpd_client = self._get_mpd()
for song in songs:
self.log.info('Adding {} to playlist'.format(song))
pos = min(1, len(mpd_client.playlistid()))
mpd_client.addid(song, pos)
insert_pos = 0 if len(mpd_client.playlistid()) == 0 else \
int(mpd_client.currentsong().get('pos', 0))
mpd_client.addid(song, insert_pos)
def _run(self):
MpcWatcher(self.q, self.conf, client=None).start()