CC-3449: Live Stream: Kick out live dj at the end of the show

- fixed so airtime sends series of kick_out events according to
cached_ahead value in cfg file.
This commit is contained in:
James 2012-03-29 16:57:28 -04:00
parent 7510e4c029
commit 7325d51ada
3 changed files with 31 additions and 28 deletions

View File

@ -634,7 +634,9 @@ class Application_Model_Schedule {
$data["status"] = array();
$data["media"] = array();
$kick_time = Application_Model_ShowInstance::GetEndTimeOfNextShowWithLiveDJ();
$kick_times = Application_Model_ShowInstance::GetEndTimeOfNextShowWithLiveDJ($range_start, $range_end);
foreach($kick_times as $kick_time_info){
$kick_time = $kick_time_info['ends'];
$temp = explode('.', Application_Model_Preference::GetDefaultTransitionFade());
// we round down transition time since PHP cannot handle millisecond. We need to
// handle this better in the future
@ -655,6 +657,7 @@ class Application_Model_Schedule {
$data["media"][$switch_start]['event_type'] = "switch_off";
$data["media"][$switch_start]['type'] = "event";
}
}
foreach ($items as $item){

View File

@ -829,19 +829,16 @@ class Application_Model_ShowInstance {
return $CC_DBC->GetOne($sql);
}
// this returns end timestamp of next show that has live DJ set up
public static function GetEndTimeOfNextShowWithLiveDJ(){
// this returns end timestamp of all shows that are in the range and has live DJ set up
public static function GetEndTimeOfNextShowWithLiveDJ($p_startTime, $p_endTime){
global $CC_CONFIG, $CC_DBC;
$date = new Application_Model_DateHelper;
$utcTimeNow = $date->getUtcTimestamp();
$sql = "SELECT ends
FROM cc_show_instances as si
JOIN cc_show as sh ON si.show_id = sh.id
WHERE si.ends > '$utcTimeNow' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
WHERE si.ends > '$p_startTime' and si.ends < '$p_endTime' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
ORDER BY si.ends";
return $CC_DBC->GetOne($sql);
return $CC_DBC->GetAll($sql);
}
}

View File

@ -562,7 +562,10 @@ class PypoFetch(Thread):
message = self.fetch_queue.get(block=True, timeout=3600)
self.handle_message(message)
except Exception, e:
self.logger.error("Exception, %s", e)
import traceback
top = traceback.format_exc()
self.logger.error('Exception: %s', e)
self.logger.error("traceback: %s", top)
success, self.schedule_data = self.api_client.get_schedule()
if success: