Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
1edfb097da
|
@ -237,8 +237,9 @@ class Application_Model_LiveLog
|
||||||
public static function SetNewLogTime($state, $dateTime){
|
public static function SetNewLogTime($state, $dateTime){
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
if ($state == 'L') {
|
$scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
||||||
|
if ($state == 'L' && $scheduled == 'on') {
|
||||||
self::SetEndTime('S', $dateTime);
|
self::SetEndTime('S', $dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +254,10 @@ class Application_Model_LiveLog
|
||||||
$sql_insert = "INSERT INTO CC_LIVE_LOG (state, start_time)"
|
$sql_insert = "INSERT INTO CC_LIVE_LOG (state, start_time)"
|
||||||
." VALUES ('$state', '{$dateTime->format("Y-m-d H:i:s")}')";
|
." VALUES ('$state', '{$dateTime->format("Y-m-d H:i:s")}')";
|
||||||
$con->exec($sql_insert);
|
$con->exec($sql_insert);
|
||||||
|
if($state == "S"){
|
||||||
|
// if scheduled play source is getting broadcasted
|
||||||
|
Application_Model_Schedule::UpdateBrodcastedStatus($dateTime, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -298,4 +303,4 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Application_Model_PlayoutHistory {
|
||||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||||
from cc_schedule as schedule
|
from cc_schedule as schedule
|
||||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
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
|
group by schedule.file_id
|
||||||
)
|
)
|
||||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||||
|
|
|
@ -412,7 +412,13 @@ class Application_Model_Preference
|
||||||
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
|
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
|
||||||
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
|
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
|
||||||
$key == 'PLAYOUT_ENGINE_CPU_PERC' ) {
|
$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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,8 +291,30 @@ class Application_Model_Schedule {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||||
." SET media_item_played=TRUE"
|
." SET media_item_played=TRUE";
|
||||||
." WHERE id=$p_id";
|
// 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);
|
$retVal = $con->exec($sql);
|
||||||
return $retVal;
|
return $retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -848,7 +848,7 @@ class Application_Model_Show {
|
||||||
$showId = $this->getId();
|
$showId = $this->getId();
|
||||||
$sql = "SELECT id FROM cc_show_instances"
|
$sql = "SELECT id FROM cc_show_instances"
|
||||||
." WHERE date(starts) = date(TIMESTAMP '$timestamp') "
|
." WHERE date(starts) = date(TIMESTAMP '$timestamp') "
|
||||||
." AND show_id = $showId";
|
." AND show_id = $showId AND rebroadcast = 0";
|
||||||
|
|
||||||
$query = $con->query($sql);
|
$query = $con->query($sql);
|
||||||
$row = ($query !== false) ? $query->fetchColumn(0) : null;
|
$row = ($query !== false) ? $query->fetchColumn(0) : null;
|
||||||
|
@ -1519,8 +1519,6 @@ class Application_Model_Show {
|
||||||
$sql = $sql." AND ({$exclude})";
|
$sql = $sql." AND ({$exclude})";
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging::debug("getShows");
|
|
||||||
Logging::debug($sql);
|
|
||||||
$result = $con->query($sql)->fetchAll();
|
$result = $con->query($sql)->fetchAll();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ function updateProgressBarValue(){
|
||||||
var scheduled_play_line_to_switch = scheduled_play_div.parent().find(".line-to-switch");
|
var scheduled_play_line_to_switch = scheduled_play_div.parent().find(".line-to-switch");
|
||||||
|
|
||||||
if (currentSong !== null){
|
if (currentSong !== null){
|
||||||
var songElpasedTime = 0;
|
var songElapsedTime = 0;
|
||||||
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||||
songElapsedTime = estimatedSchedulePosixTime - currentSong.songStartPosixTime;
|
songElapsedTime = estimatedSchedulePosixTime - currentSong.songStartPosixTime;
|
||||||
if (songPercentDone < 0 || songPercentDone > 100){
|
if (songPercentDone < 0 || songPercentDone > 100){
|
||||||
|
|
|
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#library_display tr.lib-audio').draggable({
|
$('#library_display tr.lib-audio').draggable({
|
||||||
helper: function(){
|
helper: function(){
|
||||||
|
|
||||||
var selected = mod.getChosenAudioFilesLength(),
|
var $el = $(this),
|
||||||
|
selected = mod.getChosenAudioFilesLength(),
|
||||||
container,
|
container,
|
||||||
message,
|
message,
|
||||||
li = $("#side_playlist ul li:first"),
|
li = $("#side_playlist ul li:first"),
|
||||||
width = li.width(),
|
width = li.width(),
|
||||||
height = li.height();
|
height = li.height();
|
||||||
|
|
||||||
|
//dragging an element that has an unselected checkbox.
|
||||||
|
if (mod.isChosenItem($el) === false) {
|
||||||
|
selected++;
|
||||||
|
}
|
||||||
|
|
||||||
if (selected === 0 || selected === 1) {
|
if (selected === 1) {
|
||||||
message = "Adding 1 Item.";
|
message = "Adding 1 Item.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
||||||
helper: function(){
|
helper: function(){
|
||||||
|
|
||||||
var selected = mod.getChosenItemsLength(),
|
var $el = $(this),
|
||||||
|
selected = mod.getChosenItemsLength(),
|
||||||
container,
|
container,
|
||||||
thead = $("#show_builder_table thead"),
|
thead = $("#show_builder_table thead"),
|
||||||
colspan = thead.find("th").length,
|
colspan = thead.find("th").length,
|
||||||
width = thead.find("tr:first").width(),
|
width = thead.find("tr:first").width(),
|
||||||
message;
|
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.";
|
message = "Adding 1 Item.";
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
mod.addToChosen = function($el) {
|
||||||
var id = $el.attr("id");
|
var id = $el.attr("id");
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var mod,
|
var mod,
|
||||||
oSchedTable,
|
oSchedTable,
|
||||||
SB_SELECTED_CLASS = "sb-selected",
|
SB_SELECTED_CLASS = "sb-selected",
|
||||||
|
CURSOR_SELECTED_CLASS = "cursor-selected-row",
|
||||||
|
NOW_PLAYING_CLASS = "sb-now-playing",
|
||||||
$sbContent,
|
$sbContent,
|
||||||
$sbTable,
|
$sbTable,
|
||||||
$toolbar,
|
$toolbar,
|
||||||
|
@ -79,7 +81,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.checkJumpToCurrentButton = function() {
|
mod.checkJumpToCurrentButton = function() {
|
||||||
var $current = $sbTable.find(".sb-now-playing");
|
var $current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
||||||
|
|
||||||
if ($current.length !== 0) {
|
if ($current.length !== 0) {
|
||||||
AIRTIME.button.enableButton("sb-button-current");
|
AIRTIME.button.enableButton("sb-button-current");
|
||||||
|
@ -108,13 +110,32 @@ var AIRTIME = (function(AIRTIME){
|
||||||
mod.checkJumpToCurrentButton();
|
mod.checkJumpToCurrentButton();
|
||||||
mod.checkCancelButton();
|
mod.checkCancelButton();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.selectCursor = function($el) {
|
||||||
|
|
||||||
|
$el.addClass(CURSOR_SELECTED_CLASS);
|
||||||
|
mod.checkToolBarIcons();
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.removeCursor = function($el) {
|
||||||
|
|
||||||
|
$el.removeClass(CURSOR_SELECTED_CLASS);
|
||||||
|
mod.checkToolBarIcons();
|
||||||
|
};
|
||||||
|
|
||||||
mod.getSelectedData = function() {
|
/*
|
||||||
|
* 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"),
|
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
|
||||||
aData = [],
|
aData = [],
|
||||||
i, length,
|
i, length,
|
||||||
$item;
|
$item;
|
||||||
|
|
||||||
|
if (sNot !== undefined) {
|
||||||
|
$selected = $selected.not("."+sNot);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0, length = $selected.length; i < length; i++) {
|
for (i = 0, length = $selected.length; i < length; i++) {
|
||||||
$item = $($selected.get(i));
|
$item = $($selected.get(i));
|
||||||
aData.push($item.data('aData'));
|
aData.push($item.data('aData'));
|
||||||
|
@ -513,7 +534,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$nRow.data({"aData": aData});
|
$nRow.data({"aData": aData});
|
||||||
|
|
||||||
if (aData.scheduled === 1) {
|
if (aData.scheduled === 1) {
|
||||||
$nRow.addClass("sb-now-playing");
|
$nRow.addClass(NOW_PLAYING_CLASS);
|
||||||
}
|
}
|
||||||
else if (aData.scheduled === 0) {
|
else if (aData.scheduled === 0) {
|
||||||
$nRow.addClass("sb-past");
|
$nRow.addClass("sb-past");
|
||||||
|
@ -618,7 +639,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
//order of importance of elements for setting the next timeout.
|
//order of importance of elements for setting the next timeout.
|
||||||
elements = [
|
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")
|
$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,
|
forcePlaceholderSize: true,
|
||||||
distance: 10,
|
distance: 10,
|
||||||
helper: function(event, item) {
|
helper: function(event, item) {
|
||||||
var selected = mod.getSelectedData(),
|
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||||
thead = $("#show_builder_table thead"),
|
thead = $("#show_builder_table thead"),
|
||||||
colspan = thead.find("th").length,
|
colspan = thead.find("th").length,
|
||||||
trfirst = thead.find("tr:first"),
|
trfirst = thead.find("tr:first"),
|
||||||
|
@ -816,7 +837,17 @@ var AIRTIME = (function(AIRTIME){
|
||||||
receive: fnReceive,
|
receive: fnReceive,
|
||||||
update: fnUpdate,
|
update: fnUpdate,
|
||||||
start: function(event, ui) {
|
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();
|
elements.hide();
|
||||||
}
|
}
|
||||||
|
@ -895,7 +926,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var $scroll = $sbContent.find(".dataTables_scrolling"),
|
var $scroll = $sbContent.find(".dataTables_scrolling"),
|
||||||
scrolled = $scroll.scrollTop(),
|
scrolled = $scroll.scrollTop(),
|
||||||
scrollingTop = $scroll.offset().top,
|
scrollingTop = $scroll.offset().top,
|
||||||
current = $sbTable.find(".sb-now-playing"),
|
current = $sbTable.find("."+NOW_PLAYING_CLASS),
|
||||||
currentTop = current.offset().top;
|
currentTop = current.offset().top;
|
||||||
|
|
||||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||||
|
@ -935,22 +966,20 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//add events to cursors.
|
//add events to cursors.
|
||||||
$sbTable.find("tbody").on("click", "div.marker", function(event) {
|
$sbTable.find("tbody").on("click", "div.marker", function(event) {
|
||||||
var $tr = $(this).parents("tr"),
|
var $tr = $(this).parents("tr"),
|
||||||
cursorSelClass = "cursor-selected-row";
|
$trs;
|
||||||
|
|
||||||
if ($tr.hasClass(cursorSelClass)) {
|
if ($tr.hasClass(CURSOR_SELECTED_CLASS)) {
|
||||||
$tr.removeClass(cursorSelClass);
|
mod.removeCursor($tr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tr.addClass(cursorSelClass);
|
mod.selectCursor($tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.ctrlKey === false) {
|
if (event.ctrlKey === false) {
|
||||||
$sbTable.find('.'+cursorSelClass).not($tr)
|
$trs = $sbTable.find('.'+CURSOR_SELECTED_CLASS).not($tr);
|
||||||
.removeClass(cursorSelClass);
|
mod.removeCursor($trs);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -983,7 +1012,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
if (oItems.selCurs !== undefined) {
|
if (oItems.selCurs !== undefined) {
|
||||||
|
|
||||||
callback = function() {
|
callback = function() {
|
||||||
$(this).parents('tr').next().addClass(cursorClass);
|
var $tr = $(this).parents('tr').next();
|
||||||
|
|
||||||
|
mod.selectCursor($tr);
|
||||||
};
|
};
|
||||||
|
|
||||||
oItems.selCurs.callback = callback;
|
oItems.selCurs.callback = callback;
|
||||||
|
@ -993,7 +1024,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
if (oItems.delCurs !== undefined) {
|
if (oItems.delCurs !== undefined) {
|
||||||
|
|
||||||
callback = function() {
|
callback = function() {
|
||||||
$(this).parents('tr').next().removeClass(cursorClass);
|
var $tr = $(this).parents('tr').next();
|
||||||
|
|
||||||
|
mod.removeCursor($tr);
|
||||||
};
|
};
|
||||||
|
|
||||||
oItems.delCurs.callback = callback;
|
oItems.delCurs.callback = callback;
|
||||||
|
|
Loading…
Reference in New Issue