Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-05-23 16:17:37 -04:00
commit 1edfb097da
10 changed files with 115 additions and 32 deletions

View file

@ -237,8 +237,9 @@ class Application_Model_LiveLog
public static function SetNewLogTime($state, $dateTime){
try {
$con = Propel::getConnection();
if ($state == 'L') {
$scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
if ($state == 'L' && $scheduled == 'on') {
self::SetEndTime('S', $dateTime);
}
@ -253,6 +254,10 @@ class Application_Model_LiveLog
$sql_insert = "INSERT INTO CC_LIVE_LOG (state, start_time)"
." VALUES ('$state', '{$dateTime->format("Y-m-d H:i:s")}')";
$con->exec($sql_insert);
if($state == "S"){
// if scheduled play source is getting broadcasted
Application_Model_Schedule::UpdateBrodcastedStatus($dateTime, 1);
}
}
} catch (Exception $e) {
@ -298,4 +303,4 @@ class Application_Model_LiveLog
}
}
}
}

View file

@ -66,7 +66,7 @@ class Application_Model_PlayoutHistory {
select count(schedule.file_id) as played, schedule.file_id as file_id
from cc_schedule as schedule
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
and schedule.playout_status > 0 and schedule.media_item_played != FALSE
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
group by schedule.file_id
)
AS playout left join cc_files as file on (file.id = playout.file_id)";

View file

@ -412,7 +412,13 @@ class Application_Model_Preference
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
$key == 'PLAYOUT_ENGINE_CPU_PERC' ) {
$systemInfoArray[$key] = $info[1];
if($key == 'AIRTIME_VERSION'){
// remove hash tag on the version string
list($version, $dump) = explode('+', $info[1]);
$systemInfoArray[$key] = $version;
}else{
$systemInfoArray[$key] = $info[1];
}
}
}
}

View file

@ -291,8 +291,30 @@ class Application_Model_Schedule {
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
." SET media_item_played=TRUE"
." WHERE id=$p_id";
." SET media_item_played=TRUE";
// we need to update 'broadcasted' column as well
// check the current switch status
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
if(!$live_dj && !$master_dj && $scheduled_play){
$sql .= ", broadcasted=1";
}
$sql .= " WHERE id=$p_id";
$retVal = $con->exec($sql);
return $retVal;
}
public static function UpdateBrodcastedStatus($dateTime, $value){
global $CC_CONFIG;
$con = Propel::getConnection();
$now = $dateTime->format("Y-m-d H:i:s");
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
." SET broadcasted=$value"
." WHERE starts <= '$now' AND ends >= '$now'";
$retVal = $con->exec($sql);
return $retVal;
}

View file

@ -848,7 +848,7 @@ class Application_Model_Show {
$showId = $this->getId();
$sql = "SELECT id FROM cc_show_instances"
." WHERE date(starts) = date(TIMESTAMP '$timestamp') "
." AND show_id = $showId";
." AND show_id = $showId AND rebroadcast = 0";
$query = $con->query($sql);
$row = ($query !== false) ? $query->fetchColumn(0) : null;
@ -1519,8 +1519,6 @@ class Application_Model_Show {
$sql = $sql." AND ({$exclude})";
}
Logging::debug("getShows");
Logging::debug($sql);
$result = $con->query($sql)->fetchAll();
return $result;
}