CC-3840: Deleting current playing item sometimes results in random next track playing
-possibly fixed
This commit is contained in:
parent
6098fa20e2
commit
105d752ada
|
@ -173,7 +173,7 @@ class PypoPush(Thread):
|
||||||
#Items that are in Liquidsoap's queue aren't scheduled anymore. We need to connect
|
#Items that are in Liquidsoap's queue aren't scheduled anymore. We need to connect
|
||||||
#and remove these items.
|
#and remove these items.
|
||||||
self.logger.debug("Change in link %s of current chain", problem_at_iteration)
|
self.logger.debug("Change in link %s of current chain", problem_at_iteration)
|
||||||
self.remove_from_liquidsoap_queue(problem_at_iteration, liquidsoap_queue_approx)
|
self.remove_from_liquidsoap_queue(problem_at_iteration, liquidsoap_queue_approx[problem_at_iteration:])
|
||||||
|
|
||||||
if problem_at_iteration is None and len(media_chain) > len(liquidsoap_queue_approx):
|
if problem_at_iteration is None and len(media_chain) > len(liquidsoap_queue_approx):
|
||||||
self.logger.debug("New schedule has longer current chain.")
|
self.logger.debug("New schedule has longer current chain.")
|
||||||
|
@ -340,25 +340,18 @@ class PypoPush(Thread):
|
||||||
self.telnet_lock.release()
|
self.telnet_lock.release()
|
||||||
|
|
||||||
def remove_from_liquidsoap_queue(self, problem_at_iteration, liquidsoap_queue_approx):
|
def remove_from_liquidsoap_queue(self, problem_at_iteration, liquidsoap_queue_approx):
|
||||||
iteration = 0
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
|
|
||||||
queue_copy = list(liquidsoap_queue_approx)
|
|
||||||
is_current_playing_removed = problem_at_iteration == 0
|
|
||||||
|
|
||||||
# If the current playing item is to be removed, let's remove it last
|
# If the current playing item is to be removed, let's remove it last
|
||||||
# otherwise if we remove it first, the item after it that we also intend
|
# otherwise if we remove it first, the item after it that we also intend
|
||||||
# to remove will quickly slide into the current playing position. This seems
|
# to remove will quickly slide into the current playing position. This seems
|
||||||
# to confuse Liquidsoap.
|
# to confuse Liquidsoap.
|
||||||
if is_current_playing_removed:
|
queue_copy = liquidsoap_queue_approx[::-1]
|
||||||
queue_copy = queue_copy[::-1]
|
|
||||||
|
|
||||||
for queue_item in queue_copy:
|
for queue_item in queue_copy:
|
||||||
if iteration >= problem_at_iteration:
|
|
||||||
|
|
||||||
msg = "queue.remove %s\n" % queue_item['queue_id']
|
msg = "queue.remove %s\n" % queue_item['queue_id']
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
|
@ -372,15 +365,18 @@ class PypoPush(Thread):
|
||||||
msg = "source.skip\n"
|
msg = "source.skip\n"
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
iteration += 1
|
|
||||||
|
|
||||||
if is_current_playing_removed:
|
if problem_at_iteration == 0:
|
||||||
msg = "source.skip\n"
|
msg = "source.skip\n"
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
|
|
||||||
|
msg = "queue.queue\n"
|
||||||
|
self.logger.debug(msg)
|
||||||
|
tn.write(msg)
|
||||||
|
|
||||||
tn.write("exit\n")
|
tn.write("exit\n")
|
||||||
tn.read_all()
|
self.logger.debug(tn.read_all())
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(str(e))
|
self.logger.error(str(e))
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue