From b2c63544a9b848e3aac1e72823b994504f8d39cf Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 17 May 2012 16:30:40 -0400 Subject: [PATCH] CC-3840: Deleting current playing item sometimes results in random next track playing -possibly fixed --- python_apps/pypo/airtime-playout-init-d | 4 +-- python_apps/pypo/pypopush.py | 39 ++++++++++++------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/python_apps/pypo/airtime-playout-init-d b/python_apps/pypo/airtime-playout-init-d index 8cecf7c36..e6bc0726c 100755 --- a/python_apps/pypo/airtime-playout-init-d +++ b/python_apps/pypo/airtime-playout-init-d @@ -130,8 +130,8 @@ case "${1:-''}" in 'restart-liquidsoap') # restart commands here echo -n "Restarting Liquidsoap: " - stop-liquidsoap - start-liquidsoap + liquidsoap_stop + liquidsoap_start echo "Done." ;; 'pypo-stop') diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 3d9bae8f2..5ac6c4c13 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -345,31 +345,28 @@ class PypoPush(Thread): self.telnet_lock.acquire() tn = telnetlib.Telnet(LS_HOST, LS_PORT) - # 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 - # to remove will quickly slide into the current playing position. This seems - # to confuse Liquidsoap. - queue_copy = liquidsoap_queue_approx[::-1] - - for queue_item in queue_copy: - msg = "queue.remove %s\n" % queue_item['queue_id'] - self.logger.debug(msg) - tn.write(msg) - response = tn.read_until("\r\n").strip("\r\n") - - if "No such request in my queue" in response: - """ - Cannot remove because Liquidsoap started playing the item. Need - to use source.skip instead - """ - msg = "source.skip\n" - self.logger.debug(msg) - tn.write(msg) - if problem_at_iteration == 0: msg = "source.skip\n" self.logger.debug(msg) tn.write(msg) + else: + # Remove things in reverse order. + queue_copy = liquidsoap_queue_approx[::-1] + + for queue_item in queue_copy: + msg = "queue.remove %s\n" % queue_item['queue_id'] + self.logger.debug(msg) + tn.write(msg) + response = tn.read_until("\r\n").strip("\r\n") + + if "No such request in my queue" in response: + """ + Cannot remove because Liquidsoap started playing the item. Need + to use source.skip instead + """ + msg = "source.skip\n" + self.logger.debug(msg) + tn.write(msg) msg = "queue.queue\n" self.logger.debug(msg)