early implementation of CC-1962
This commit is contained in:
parent
f4a86d96c6
commit
e16dd6c486
|
@ -188,7 +188,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->showContent = $show->getShowContent();
|
$this->view->showContent = $show->getShowContent();
|
||||||
$this->view->timeFilled = $show->getTimeScheduled();
|
$this->view->timeFilled = $show->getTimeScheduled();
|
||||||
$this->view->percentFilled = $show->getPercentScheduledInRange();
|
$this->view->percentFilled = $show->getPercentScheduled();
|
||||||
|
|
||||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||||
unset($this->view->showContent);
|
unset($this->view->showContent);
|
||||||
|
@ -237,7 +237,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->showContent = $show->getShowContent();
|
$this->view->showContent = $show->getShowContent();
|
||||||
$this->view->timeFilled = $show->getTimeScheduled();
|
$this->view->timeFilled = $show->getTimeScheduled();
|
||||||
$this->view->percentFilled = $show->getPercentScheduledInRange();
|
$this->view->percentFilled = $show->getPercentScheduled();
|
||||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||||
unset($this->view->showContent);
|
unset($this->view->showContent);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->timeFilled = $show->getTimeScheduled();
|
$this->view->timeFilled = $show->getTimeScheduled();
|
||||||
$this->view->showName = $show->getName();
|
$this->view->showName = $show->getName();
|
||||||
$this->view->showLength = $show->getShowLength();
|
$this->view->showLength = $show->getShowLength();
|
||||||
$this->view->percentFilled = $show->getPercentScheduledInRange();
|
$this->view->percentFilled = $show->getPercentScheduled();
|
||||||
|
|
||||||
$this->view->s_wday = $dateInfo_s['weekday'];
|
$this->view->s_wday = $dateInfo_s['weekday'];
|
||||||
$this->view->s_month = $dateInfo_s['month'];
|
$this->view->s_month = $dateInfo_s['month'];
|
||||||
|
|
|
@ -278,12 +278,11 @@ class Schedule {
|
||||||
return ($count == '0');
|
return ($count == '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTimeUnScheduledInRange($s_datetime, $e_datetime) {
|
public static function getTimeUnScheduledInRange($instance_id, $s_datetime, $e_datetime) {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]."
|
$sql = "SELECT SUM(clip_length) FROM $CC_CONFIG[scheduleTable]"
|
||||||
WHERE (starts >= '{$s_datetime}')
|
." WHERE instance_id = $instance_id";
|
||||||
AND (ends <= '{$e_datetime}')";
|
|
||||||
|
|
||||||
$time = $CC_DBC->GetOne($sql);
|
$time = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
@ -313,6 +312,20 @@ class Schedule {
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetTotalShowTime($instance_id) {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT SUM(clip_length) FROM $CC_CONFIG[scheduleTable]"
|
||||||
|
." WHERE instance_id = $instance_id";
|
||||||
|
|
||||||
|
$res = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
if(is_null($res))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getPercentScheduledInRange($s_datetime, $e_datetime) {
|
public static function getPercentScheduledInRange($s_datetime, $e_datetime) {
|
||||||
|
|
||||||
|
@ -337,6 +350,25 @@ class Schedule {
|
||||||
return $percent;
|
return $percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetPercentScheduled($instance_id, $s_datetime, $e_datetime){
|
||||||
|
$time = Schedule::GetTotalShowTime($instance_id);
|
||||||
|
|
||||||
|
$s_epoch = strtotime($s_datetime);
|
||||||
|
$e_epoch = strtotime($e_datetime);
|
||||||
|
|
||||||
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
$sql = "SELECT EXTRACT(EPOCH FROM INTERVAL '{$time}')";
|
||||||
|
$r = $con->query($sql);
|
||||||
|
$i_epoch = $r->fetchColumn(0);
|
||||||
|
|
||||||
|
$percent = ceil(($i_epoch / ($e_epoch - $s_epoch)) * 100);
|
||||||
|
|
||||||
|
if ($percent > 100)
|
||||||
|
$percent = 100;
|
||||||
|
|
||||||
|
return $percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return TRUE if file is going to be played in the future.
|
* Return TRUE if file is going to be played in the future.
|
||||||
|
@ -490,7 +522,8 @@ class Schedule {
|
||||||
." WHERE st.playlist_id = pt.id"
|
." WHERE st.playlist_id = pt.id"
|
||||||
." AND st.file_id = ft.id"
|
." AND st.file_id = ft.id"
|
||||||
." AND st.instance_id = si.id"
|
." AND st.instance_id = si.id"
|
||||||
." AND si.show_id = show.id";
|
." AND si.show_id = show.id"
|
||||||
|
." AND st.starts < si.ends";
|
||||||
|
|
||||||
if ($timePeriod < 0){
|
if ($timePeriod < 0){
|
||||||
$sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
|
$sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
|
||||||
|
|
|
@ -456,6 +456,10 @@ class ShowInstance {
|
||||||
return $showInstance->getDbShowId();
|
return $showInstance->getDbShowId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getShowInstanceId() {
|
||||||
|
return $this->_instanceId;
|
||||||
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
$show = CcShowQuery::create()->findPK($this->getShowId());
|
$show = CcShowQuery::create()->findPK($this->getShowId());
|
||||||
return $show->getDbName();
|
return $show->getDbName();
|
||||||
|
@ -635,11 +639,8 @@ class ShowInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTimeScheduled() {
|
public function getTimeScheduled() {
|
||||||
|
$instance_id = $this->getShowInstanceId();
|
||||||
$start_timestamp = $this->getShowStart();
|
$time = Schedule::GetTotalShowTime($instance_id);
|
||||||
$end_timestamp = $this->getShowEnd();
|
|
||||||
|
|
||||||
$time = Schedule::getTimeScheduledInRange($start_timestamp, $end_timestamp);
|
|
||||||
|
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
|
@ -648,8 +649,9 @@ class ShowInstance {
|
||||||
|
|
||||||
$start_timestamp = $this->getShowStart();
|
$start_timestamp = $this->getShowStart();
|
||||||
$end_timestamp = $this->getShowEnd();
|
$end_timestamp = $this->getShowEnd();
|
||||||
|
$instance_id = $this->getShowInstanceId();
|
||||||
|
|
||||||
$time = Schedule::getTimeUnScheduledInRange($start_timestamp, $end_timestamp);
|
$time = Schedule::getTimeUnScheduledInRange($instance_id, $start_timestamp, $end_timestamp);
|
||||||
|
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
|
@ -662,6 +664,14 @@ class ShowInstance {
|
||||||
return Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);
|
return Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPercentScheduled(){
|
||||||
|
$start_timestamp = $this->getShowStart();
|
||||||
|
$end_timestamp = $this->getShowEnd();
|
||||||
|
$instance_id = $this->getShowInstanceId();
|
||||||
|
|
||||||
|
return Schedule::GetPercentScheduled($instance_id, $start_timestamp, $end_timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
public function getShowLength(){
|
public function getShowLength(){
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
|
@ -794,6 +804,7 @@ class Show_DAL{
|
||||||
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
|
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
|
||||||
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
||||||
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
||||||
|
." AND (st.starts < si.ends)"
|
||||||
." ORDER BY st.starts";
|
." ORDER BY st.starts";
|
||||||
|
|
||||||
return $CC_DBC->GetAll($sql);
|
return $CC_DBC->GetAll($sql);
|
||||||
|
|
|
@ -1671,7 +1671,7 @@ class StoredFile {
|
||||||
|
|
||||||
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
|
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
|
||||||
|
|
||||||
$datatables["optWhere"][] = "plt.length <= INTERVAL '{$p_length}'";
|
$datatables["optWhere"][] = "INTERVAL '{$p_length}' > INTERVAL '00:00:00'";
|
||||||
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
|
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
|
||||||
|
|
||||||
return StoredFile::searchFiles($fromTable, $datatables);
|
return StoredFile::searchFiles($fromTable, $datatables);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<div id="show_progressbar"></div>
|
<div id="show_progressbar"></div>
|
||||||
<span id="show_length" class="time"><?php echo $this->showLength; ?></span>
|
<span id="show_length" class="time"><?php echo $this->showLength; ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="show_time_warning"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,6 +22,15 @@ function setScheduleDialogHtml(json) {
|
||||||
|
|
||||||
$("#show_time_filled").empty().append(json.timeFilled);
|
$("#show_time_filled").empty().append(json.timeFilled);
|
||||||
$("#show_progressbar").progressbar( "value" , json.percentFilled );
|
$("#show_progressbar").progressbar( "value" , json.percentFilled );
|
||||||
|
|
||||||
|
var showFilled = $("#show_time_filled").text().split('.')[0];
|
||||||
|
var showLength = $("#show_length").text();
|
||||||
|
|
||||||
|
if (showFilled > showLength){
|
||||||
|
$("#show_time_warning").text("Shows longer than their scheduled time will be cut off by a following show.");
|
||||||
|
} else {
|
||||||
|
$("#show_time_warning").empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setScheduleDialogEvents(dialog) {
|
function setScheduleDialogEvents(dialog) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ var columns = [{"sTitle": "type", "bVisible":false},
|
||||||
{"sTitle":"Album"},
|
{"sTitle":"Album"},
|
||||||
{"sTitle":"Playlist"},
|
{"sTitle":"Playlist"},
|
||||||
{"sTitle":"Show"},
|
{"sTitle":"Show"},
|
||||||
{"sTitle":"instance_id", "bVisible":true}];
|
{"sTitle":"instance_id", "bVisible":false}];
|
||||||
|
|
||||||
function getDateString(){
|
function getDateString(){
|
||||||
var date0 = $("#datepicker").datepicker("getDate");
|
var date0 = $("#datepicker").datepicker("getDate");
|
||||||
|
|
|
@ -39,10 +39,14 @@ end
|
||||||
# by default
|
# by default
|
||||||
def add_skip_command(s)
|
def add_skip_command(s)
|
||||||
# A command to skip
|
# A command to skip
|
||||||
def skip(_)
|
def skip(_)
|
||||||
source.skip(s)
|
l = list.hd(server.execute("queue.queue"))
|
||||||
"Done!"
|
l = string.split(separator=" ",l)
|
||||||
end
|
list.iter(fun (rid) -> ignore(server.execute(queue.ignore #{rid}")), l)
|
||||||
|
|
||||||
|
source.skip(s)
|
||||||
|
"Done!"
|
||||||
|
end
|
||||||
# Register the command:
|
# Register the command:
|
||||||
server.register(namespace="source",
|
server.register(namespace="source",
|
||||||
usage="skip",
|
usage="skip",
|
||||||
|
|
Loading…
Reference in New Issue