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

- PHP side implementation
This commit is contained in:
James 2012-03-22 16:23:59 -04:00
parent 24260e8908
commit f8d3a8c8bb
3 changed files with 26 additions and 1 deletions

View file

@ -163,7 +163,11 @@ class Application_Model_Preference
}
public static function GetDefaultTransitionFade() {
return self::GetValue("default_transition_fade");
$transition_fade = self::GetValue("default_transition_fade");
if($transition_fade == ""){
$transition_fade = "00.000000";
}
return $transition_fade;
}
public static function SetStreamLabelFormat($type){

View file

@ -633,6 +633,11 @@ class Application_Model_Schedule {
$data["status"] = array();
$data["media"] = array();
$data["harbor"] = array();
$data["harbor"]['next_live_dj_show_end'] = Application_Model_ShowInstance::GetEndTimeOfNextShowWithLiveDJ();
$data["harbor"]['transition_fade'] = Application_Model_Preference::GetDefaultTransitionFade();
foreach ($items as $item){

View file

@ -827,4 +827,20 @@ class Application_Model_ShowInstance {
$sql = "SELECT count(*) as cnt FROM $CC_CONFIG[showInstances] WHERE ends < '$day'";
return $CC_DBC->GetOne($sql);
}
// this returns end timestamp of next show that has live DJ set up
public static function GetEndTimeOfNextShowWithLiveDJ(){
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)
ORDER BY si.ends";
return $CC_DBC->GetOne($sql);
}
}