From 628e6bed374a7490c8d64954e1e881fba7803a3c Mon Sep 17 00:00:00 2001 From: James Date: Thu, 8 Nov 2012 17:26:55 -0500 Subject: [PATCH] CC-4689: Live Stream: The 1st song of a show won't play if there is another show have live stream assigned and finished right before - fixed --- airtime_mvc/application/models/Schedule.php | 2 +- python_apps/pypo/pypopush.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 3a03a4369..53f6a98c7 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -687,7 +687,7 @@ SQL; 'end' => $end, 'show_name' => $item["show_name"], 'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"], - 'independent_event' => true + 'independent_event' => false ); self::appendScheduleItem($data, $start, $schedule_item); } diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 5bcce21b6..0382b5e06 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -120,6 +120,10 @@ class PypoPush(Thread): next_media_item_chain = self.get_next_schedule_chain(chains, datetime.utcnow()) if next_media_item_chain is not None: + try: + chains.remove(next_media_item_chain) + except ValueError, e: + self.logger.error(str(e)) chain_start = datetime.strptime(next_media_item_chain[0]['start'], "%Y-%m-%d-%H-%M-%S") time_until_next_play = self.date_interval_to_seconds(chain_start - datetime.utcnow()) self.logger.debug("Blocking %s seconds until show start", time_until_next_play) @@ -405,8 +409,9 @@ class PypoPush(Thread): closest_chain = None for chain in chains: chain_start = datetime.strptime(chain[0]['start'], "%Y-%m-%d-%H-%M-%S") + chain_end = datetime.strptime(chain[-1]['end'], "%Y-%m-%d-%H-%M-%S") self.logger.debug("tnow %s, chain_start %s", tnow, chain_start) - if (closest_start == None or chain_start < closest_start) and chain_start > tnow: + if (closest_start == None or chain_start < closest_start) and (chain_start > tnow or (chain_start < tnow and chain_end > tnow)): closest_start = chain_start closest_chain = chain