Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
1edfb097da
|
@ -238,7 +238,8 @@ class Application_Model_LiveLog
|
|||
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) {
|
||||
|
|
|
@ -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)";
|
||||
|
|
|
@ -412,10 +412,16 @@ 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' ) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$outputArray = array();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ function updateProgressBarValue(){
|
|||
var scheduled_play_line_to_switch = scheduled_play_div.parent().find(".line-to-switch");
|
||||
|
||||
if (currentSong !== null){
|
||||
var songElpasedTime = 0;
|
||||
var songElapsedTime = 0;
|
||||
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||
songElapsedTime = estimatedSchedulePosixTime - currentSong.songStartPosixTime;
|
||||
if (songPercentDone < 0 || songPercentDone > 100){
|
||||
|
|
|
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
|||
$('#library_display tr.lib-audio').draggable({
|
||||
helper: function(){
|
||||
|
||||
var selected = mod.getChosenAudioFilesLength(),
|
||||
var $el = $(this),
|
||||
selected = mod.getChosenAudioFilesLength(),
|
||||
container,
|
||||
message,
|
||||
li = $("#side_playlist ul li:first"),
|
||||
width = li.width(),
|
||||
height = li.height();
|
||||
|
||||
if (selected === 0 || selected === 1) {
|
||||
//dragging an element that has an unselected checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = "Adding 1 Item.";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
|||
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
||||
helper: function(){
|
||||
|
||||
var selected = mod.getChosenItemsLength(),
|
||||
var $el = $(this),
|
||||
selected = mod.getChosenItemsLength(),
|
||||
container,
|
||||
thead = $("#show_builder_table thead"),
|
||||
colspan = thead.find("th").length,
|
||||
width = thead.find("tr:first").width(),
|
||||
message;
|
||||
|
||||
if (selected === 0 || selected === 1) {
|
||||
//dragging an element that has an unselected checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = "Adding 1 Item.";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -98,6 +98,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
};
|
||||
|
||||
mod.isChosenItem = function($el) {
|
||||
var id = $el.attr("id"),
|
||||
item = chosenItems[id];
|
||||
|
||||
return item !== undefined ? true : false;
|
||||
};
|
||||
|
||||
mod.addToChosen = function($el) {
|
||||
var id = $el.attr("id");
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
var mod,
|
||||
oSchedTable,
|
||||
SB_SELECTED_CLASS = "sb-selected",
|
||||
CURSOR_SELECTED_CLASS = "cursor-selected-row",
|
||||
NOW_PLAYING_CLASS = "sb-now-playing",
|
||||
$sbContent,
|
||||
$sbTable,
|
||||
$toolbar,
|
||||
|
@ -79,7 +81,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.checkJumpToCurrentButton = function() {
|
||||
var $current = $sbTable.find(".sb-now-playing");
|
||||
var $current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
||||
|
||||
if ($current.length !== 0) {
|
||||
AIRTIME.button.enableButton("sb-button-current");
|
||||
|
@ -109,12 +111,31 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.checkCancelButton();
|
||||
};
|
||||
|
||||
mod.getSelectedData = function() {
|
||||
mod.selectCursor = function($el) {
|
||||
|
||||
$el.addClass(CURSOR_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.removeCursor = function($el) {
|
||||
|
||||
$el.removeClass(CURSOR_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
/*
|
||||
* sNot is an optional string to filter selected elements by. (ex removing the currently playing item)
|
||||
*/
|
||||
mod.getSelectedData = function(sNot) {
|
||||
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
|
||||
aData = [],
|
||||
i, length,
|
||||
$item;
|
||||
|
||||
if (sNot !== undefined) {
|
||||
$selected = $selected.not("."+sNot);
|
||||
}
|
||||
|
||||
for (i = 0, length = $selected.length; i < length; i++) {
|
||||
$item = $($selected.get(i));
|
||||
aData.push($item.data('aData'));
|
||||
|
@ -513,7 +534,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$nRow.data({"aData": aData});
|
||||
|
||||
if (aData.scheduled === 1) {
|
||||
$nRow.addClass("sb-now-playing");
|
||||
$nRow.addClass(NOW_PLAYING_CLASS);
|
||||
}
|
||||
else if (aData.scheduled === 0) {
|
||||
$nRow.addClass("sb-past");
|
||||
|
@ -618,7 +639,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//order of importance of elements for setting the next timeout.
|
||||
elements = [
|
||||
$sbTable.find("tr.sb-now-playing"),
|
||||
$sbTable.find("tr."+NOW_PLAYING_CLASS),
|
||||
$sbTable.find("tbody").find("tr.sb-future.sb-footer, tr.sb-future.sb-header").filter(":first")
|
||||
];
|
||||
|
||||
|
@ -776,7 +797,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
forcePlaceholderSize: true,
|
||||
distance: 10,
|
||||
helper: function(event, item) {
|
||||
var selected = mod.getSelectedData(),
|
||||
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||
thead = $("#show_builder_table thead"),
|
||||
colspan = thead.find("th").length,
|
||||
trfirst = thead.find("tr:first"),
|
||||
|
@ -816,7 +837,17 @@ var AIRTIME = (function(AIRTIME){
|
|||
receive: fnReceive,
|
||||
update: fnUpdate,
|
||||
start: function(event, ui) {
|
||||
var elements = $sbTable.find('tr:not(:first) input:checked').parents('tr');
|
||||
/*
|
||||
var elements = $sbTable.find('tr input:checked').parents('tr')
|
||||
.not(ui.item)
|
||||
.not("."+NOW_PLAYING_CLASS);
|
||||
|
||||
//remove all other items from the screen,
|
||||
//don't remove ui.item or else we can not get position information when the user drops later.
|
||||
elements.remove();
|
||||
*/
|
||||
|
||||
var elements = $sbTable.find('tr input:checked').parents('tr');
|
||||
|
||||
elements.hide();
|
||||
}
|
||||
|
@ -895,7 +926,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
var $scroll = $sbContent.find(".dataTables_scrolling"),
|
||||
scrolled = $scroll.scrollTop(),
|
||||
scrollingTop = $scroll.offset().top,
|
||||
current = $sbTable.find(".sb-now-playing"),
|
||||
current = $sbTable.find("."+NOW_PLAYING_CLASS),
|
||||
currentTop = current.offset().top;
|
||||
|
||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||
|
@ -935,22 +966,20 @@ var AIRTIME = (function(AIRTIME){
|
|||
//add events to cursors.
|
||||
$sbTable.find("tbody").on("click", "div.marker", function(event) {
|
||||
var $tr = $(this).parents("tr"),
|
||||
cursorSelClass = "cursor-selected-row";
|
||||
$trs;
|
||||
|
||||
if ($tr.hasClass(cursorSelClass)) {
|
||||
$tr.removeClass(cursorSelClass);
|
||||
if ($tr.hasClass(CURSOR_SELECTED_CLASS)) {
|
||||
mod.removeCursor($tr);
|
||||
}
|
||||
else {
|
||||
$tr.addClass(cursorSelClass);
|
||||
mod.selectCursor($tr);
|
||||
}
|
||||
|
||||
if (event.ctrlKey === false) {
|
||||
$sbTable.find('.'+cursorSelClass).not($tr)
|
||||
.removeClass(cursorSelClass);
|
||||
$trs = $sbTable.find('.'+CURSOR_SELECTED_CLASS).not($tr);
|
||||
mod.removeCursor($trs);
|
||||
}
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -983,7 +1012,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (oItems.selCurs !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$(this).parents('tr').next().addClass(cursorClass);
|
||||
var $tr = $(this).parents('tr').next();
|
||||
|
||||
mod.selectCursor($tr);
|
||||
};
|
||||
|
||||
oItems.selCurs.callback = callback;
|
||||
|
@ -993,7 +1024,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (oItems.delCurs !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$(this).parents('tr').next().removeClass(cursorClass);
|
||||
var $tr = $(this).parents('tr').next();
|
||||
|
||||
mod.removeCursor($tr);
|
||||
};
|
||||
|
||||
oItems.delCurs.callback = callback;
|
||||
|
|
Loading…
Reference in New Issue