parent
066377e589
commit
be23532cda
1 changed files with 4 additions and 2 deletions
|
@ -49,7 +49,9 @@ class Player(gevent.Greenlet):
|
||||||
def check_playlist(self):
|
def check_playlist(self):
|
||||||
mpd_client = self._get_mpd()
|
mpd_client = self._get_mpd()
|
||||||
songs = mpd_client.playlist()
|
songs = mpd_client.playlist()
|
||||||
if(len(songs) >= self.min_playlist_length):
|
current = mpd_client.currentsong()
|
||||||
|
pos = int(current.get('pos', 0)) + 1
|
||||||
|
if(len(songs) - pos >= self.min_playlist_length):
|
||||||
return
|
return
|
||||||
self.log.info('need to add new songs')
|
self.log.info('need to add new songs')
|
||||||
picker = gevent.Greenlet(audiogenerate,
|
picker = gevent.Greenlet(audiogenerate,
|
||||||
|
@ -73,7 +75,7 @@ class Player(gevent.Greenlet):
|
||||||
# emitter = value['emitter']
|
# emitter = value['emitter']
|
||||||
kind = value['kind']
|
kind = value['kind']
|
||||||
args = value['args']
|
args = value['args']
|
||||||
if kind == 'timer' or (kind == 'mpc' and args[0] == 'playlist'):
|
if kind == 'timer' or (kind == 'mpc' and args[0] in ('player', 'playlist')):
|
||||||
gevent.Greenlet.spawn(self.check_playlist)
|
gevent.Greenlet.spawn(self.check_playlist)
|
||||||
elif kind == 'mpc':
|
elif kind == 'mpc':
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue