Make update check take longer + add from proper location

rr/dockerize
Ryan Rix 7 years ago
parent 32c60c085f
commit bc5d44bada

@ -71,18 +71,21 @@ class CmdListener:
if event['age'] < 5000:
self.cmd_queue.put(event)
def __newfile_play(self,fname,max_attempts=25):
def __newfile_play(self,fname,max_attempts=60):
# Do update check
attempts = 0
gotfile = False
self.mpc.update(False, "download/")
while attempts < max_attempts and not gotfile:
musiclist = self.mpc.listall()
gotfile = fname in musiclist
fullname = ('download/' + fname)
gotfile = fullname in musiclist
if not gotfile:
sleep(0.5)
attempts += 1
sleep(1)
attempts += 1
if gotfile:
self.mpc.add(fname)
print("Adding {} to playlist".format(fname))
self.mpc.add('download/' + fname)
self.mpc.play()
def __parse_command(self,cmd,event,cmd_regular):

Loading…
Cancel
Save