Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
de3c95bd36
|
@ -138,6 +138,8 @@ $CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
|
||||||
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
|
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
|
||||||
$CC_CONFIG['backupTable'] = $CC_CONFIG['tblNamePrefix'].'backup';
|
$CC_CONFIG['backupTable'] = $CC_CONFIG['tblNamePrefix'].'backup';
|
||||||
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
|
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
|
||||||
|
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
|
||||||
|
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
|
||||||
|
|
||||||
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
|
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
|
||||||
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
|
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
|
||||||
|
|
|
@ -5,7 +5,9 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
/* Initialize action controller here */
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
|
$ajaxContext->addActionContext('get-hosts', 'json')
|
||||||
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -32,9 +34,10 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getHostsAction()
|
public function getHostsAction()
|
||||||
{
|
{
|
||||||
$this->view->hosts = User::getHosts();
|
$search = $this->_getParam('term');
|
||||||
}
|
|
||||||
|
|
||||||
|
$this->view->hosts = User::getHosts($search);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,11 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
||||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||||
{
|
{
|
||||||
$controller = strtolower($request->getControllerName());
|
$controller = strtolower($request->getControllerName());
|
||||||
|
|
||||||
if (!Zend_Auth::getInstance()->hasIdentity()){
|
if ($controller == 'api'){
|
||||||
|
$this->setRoleName("G");
|
||||||
|
|
||||||
|
} else if (!Zend_Auth::getInstance()->hasIdentity()){
|
||||||
|
|
||||||
if ($controller !== 'login') {
|
if ($controller !== 'login') {
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
$hosts = User::getHosts();
|
$hosts = User::getHosts();
|
||||||
|
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
$options[$host['id']] = $host['login'];
|
$options[$host['value']] = $host['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add hosts selection
|
//Add hosts selection
|
||||||
|
|
|
@ -9,7 +9,8 @@ class Application_Model_Nowplaying
|
||||||
$current = Schedule::GetCurrentlyPlaying($timeNow);
|
$current = Schedule::GetCurrentlyPlaying($timeNow);
|
||||||
$next = Schedule::GetNextItems($timeNow, 10);
|
$next = Schedule::GetNextItems($timeNow, 10);
|
||||||
|
|
||||||
$columnHeaders = array(array("sTitle"=>"Date"),
|
$columnHeaders = array(array("sTitle"=>"type", "bVisible"=>false),
|
||||||
|
array("sTitle"=>"Date"),
|
||||||
array("sTitle"=>"Start"),
|
array("sTitle"=>"Start"),
|
||||||
array("sTitle"=>"End"),
|
array("sTitle"=>"End"),
|
||||||
array("sTitle"=>"Duration"),
|
array("sTitle"=>"Duration"),
|
||||||
|
@ -21,19 +22,19 @@ class Application_Model_Nowplaying
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
foreach ($previous as $item){
|
foreach ($previous as $item){
|
||||||
array_push($rows, array($item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], "x" , "y"));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($current as $item){
|
foreach ($current as $item){
|
||||||
array_push($rows, array($item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], "x" , "y"));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($next as $item){
|
foreach ($next as $item){
|
||||||
array_push($rows, array($item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], "x" , "y"));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
||||||
|
|
|
@ -479,9 +479,13 @@ class Schedule {
|
||||||
|
|
||||||
public static function GetPreviousItems($timeNow, $prevCount = 1){
|
public static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt"
|
||||||
." WHERE (st.ends < TIMESTAMP '$timeNow')"
|
." WHERE (st.ends < TIMESTAMP '$timeNow')"
|
||||||
|
." AND (st.playlist_id = pt.id)"
|
||||||
." AND (st.file_id = ft.id)"
|
." AND (st.file_id = ft.id)"
|
||||||
|
." AND (st.group_id = sst.group_id)"
|
||||||
|
." AND (sdt.show_id = sst.show_id)"
|
||||||
." ORDER BY st.starts DESC"
|
." ORDER BY st.starts DESC"
|
||||||
." LIMIT $prevCount";
|
." LIMIT $prevCount";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
@ -491,21 +495,28 @@ class Schedule {
|
||||||
public static function GetCurrentlyPlaying($timeNow){
|
public static function GetCurrentlyPlaying($timeNow){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$sql = "SELECT *, pt.name as playlistName FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt"
|
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st,"
|
||||||
|
."$CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt"
|
||||||
." WHERE (st.starts < TIMESTAMP '$timeNow')"
|
." WHERE (st.starts < TIMESTAMP '$timeNow')"
|
||||||
." AND (st.ends > TIMESTAMP '$timeNow')"
|
." AND (st.ends > TIMESTAMP '$timeNow')"
|
||||||
." AND (st.playlist_id = pt.id)"
|
." AND (st.playlist_id = pt.id)"
|
||||||
." AND (st.file_id = ft.id)";
|
." AND (st.file_id = ft.id)"
|
||||||
|
." AND (st.group_id = sst.group_id)"
|
||||||
|
." AND (sdt.show_id = sst.show_id)";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetNextItems($timeNow, $nextCount = 1) {
|
public static function GetNextItems($timeNow, $nextCount = 1) {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$sql = "SELECT *, pt.name as playlistName FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt"
|
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt"
|
||||||
." WHERE (st.starts > TIMESTAMP '$timeNow')"
|
." WHERE (st.starts > TIMESTAMP '$timeNow')"
|
||||||
." AND (st.file_id = ft.id)"
|
|
||||||
." AND (st.playlist_id = pt.id)"
|
." AND (st.playlist_id = pt.id)"
|
||||||
|
." AND (st.file_id = ft.id)"
|
||||||
|
." AND (st.group_id = sst.group_id)"
|
||||||
|
." AND (sdt.show_id = sst.show_id)"
|
||||||
." ORDER BY st.starts"
|
." ORDER BY st.starts"
|
||||||
." LIMIT $nextCount";
|
." LIMIT $nextCount";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
|
|
@ -416,7 +416,7 @@ class Show {
|
||||||
// must not delete shows in the past
|
// must not delete shows in the past
|
||||||
if($show->getDbRepeats() && ($start_epoch < $date_epoch)) {
|
if($show->getDbRepeats() && ($start_epoch < $date_epoch)) {
|
||||||
|
|
||||||
$sql = "DELETE FROM cc_show_days WHERE first_show >= '{$date}' ";
|
$sql = "DELETE FROM cc_show_days WHERE first_show >= '{$date}' AND show_id = '{$this->_showId}'";
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
//echo $sql;
|
//echo $sql;
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ class Show {
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
//echo $sql;
|
//echo $sql;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT group_id FROM cc_schedule WHERE starts > '{$timestamp}' ";
|
$sql = "SELECT group_id FROM cc_show_schedule WHERE show_day >= '{$date}' AND show_id = '{$this->_showId}'";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
|
||||||
$sql_opt = array();
|
$sql_opt = array();
|
||||||
|
|
|
@ -39,39 +39,37 @@ class User {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsers($type=NULL, $search=NULL) {
|
public static function getUsers($type, $search=NULL) {
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
$sql;
|
$sql;
|
||||||
|
|
||||||
$sql_gen = "SELECT id, login FROM cc_subjs ";
|
$sql_gen = "SELECT id AS value, login AS label FROM cc_subjs ";
|
||||||
$sql = $sql_gen;
|
$sql = $sql_gen;
|
||||||
|
|
||||||
|
if(is_array($type)) {
|
||||||
|
for($i=0; $i<count($type); $i++) {
|
||||||
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
|
}
|
||||||
|
$sql_type = join(" OR ", $type);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql_type = "type = {$type}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = $sql_gen ." WHERE (". $sql_type.")";
|
||||||
|
|
||||||
if(!is_null($type)){
|
|
||||||
|
|
||||||
if(is_array($type)) {
|
|
||||||
for($i=0; $i<count($type); $i++) {
|
|
||||||
$type[$i] = "type = '{$type[$i]}'";
|
|
||||||
}
|
|
||||||
$sql_type = join(" OR ", $type);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sql_type = "type = {$type}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = $sql_gen ." WHERE ". $sql_type;
|
|
||||||
}
|
|
||||||
if(!is_null($search)) {
|
if(!is_null($search)) {
|
||||||
$like = "login ILIKE '{$search}'";
|
$like = "login ILIKE '%{$search}%'";
|
||||||
}
|
|
||||||
|
|
||||||
$sql = $sql . " ORDER BY login";
|
$sql = $sql . " AND ".$like." ORDER BY login";
|
||||||
|
}
|
||||||
|
|
||||||
return $CC_DBC->GetAll($sql);
|
return $CC_DBC->GetAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHosts() {
|
public static function getHosts($search=NULL) {
|
||||||
return User::getUsers(array('H', 'A'));
|
return User::getUsers(array('H', 'A'), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<div id='demo'></div>
|
<div id='demo'></div>
|
||||||
<script>
|
<script>
|
||||||
function getDateText(obj){
|
function getDateText(obj){
|
||||||
|
//var str = "";
|
||||||
|
//for (s in obj.oSettings)
|
||||||
|
// str += s + ", ";
|
||||||
|
//alert(str);
|
||||||
var str = obj.aData[ obj.iDataColumn ];
|
var str = obj.aData[ obj.iDataColumn ];
|
||||||
if (str.indexOf(" ") != -1){
|
if (str.indexOf(" ") != -1){
|
||||||
return changeTimePrecision(str.substring(0, str.indexOf(" ")));
|
return changeTimePrecision(str.substring(0, str.indexOf(" ")));
|
||||||
|
@ -30,13 +34,26 @@ function changeTimePrecision(str){
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDataGrid(obj){
|
function notifySongEnd(){
|
||||||
|
for (row in datagridData.rows){
|
||||||
|
if (row[0] == "c")
|
||||||
|
row[0] = "p";
|
||||||
|
if (row[0] == "n"){
|
||||||
|
row[0] = "c";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obj.columnHeaders[0]["fnRender"] = getDateText;
|
createDataGrid();
|
||||||
obj.columnHeaders[1]["fnRender"] = getTimeText;
|
}
|
||||||
obj.columnHeaders[2]["fnRender"] = getTimeText;
|
|
||||||
obj.columnHeaders[3]["fnRender"] = changeTimePrecisionInit;
|
function createDataGrid(){
|
||||||
|
|
||||||
|
datagridData.columnHeaders[1]["fnRender"] = getDateText;
|
||||||
|
datagridData.columnHeaders[2]["fnRender"] = getTimeText;
|
||||||
|
datagridData.columnHeaders[3]["fnRender"] = getTimeText;
|
||||||
|
datagridData.columnHeaders[4]["fnRender"] = changeTimePrecisionInit;
|
||||||
|
|
||||||
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
|
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bSort" : false,
|
"bSort" : false,
|
||||||
|
@ -44,16 +61,34 @@ function createDataGrid(obj){
|
||||||
"bFilter": true,
|
"bFilter": true,
|
||||||
"bInfo": false,
|
"bInfo": false,
|
||||||
"bLengthChange": false,
|
"bLengthChange": false,
|
||||||
"aaData": obj.rows,
|
"aaData": datagridData.rows,
|
||||||
"aoColumns": obj.columnHeaders
|
"aoColumns": datagridData.columnHeaders,
|
||||||
|
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||||
|
if (aData[0] == "p"){
|
||||||
|
//$(nRow).attr("style", "background-color:blue;");
|
||||||
|
} else if (aData[0] == "c"){
|
||||||
|
$(nRow).attr("style", "background-color:#61B329;");
|
||||||
|
} else if (aData[0] == "n"){
|
||||||
|
}
|
||||||
|
return nRow;
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var registered = false
|
||||||
|
|
||||||
function init2(){
|
function init2(){
|
||||||
$.ajax({ url: "/Nowplaying/get-data-grid-data/format/json", dataType:"json", success:function(data){
|
$.ajax({ url: "/Nowplaying/get-data-grid-data/format/json", dataType:"json", success:function(data){
|
||||||
createDataGrid(data.entries);
|
datagridData = data.entries;
|
||||||
|
createDataGrid();
|
||||||
}});
|
}});
|
||||||
//setTimeout(init2, 5000);
|
|
||||||
|
if (typeof registerSongEndListener == 'function' && !registered){
|
||||||
|
registered = true;
|
||||||
|
registerSongEndListener(notifySongEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(init2, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
@ -14,10 +14,11 @@
|
||||||
<div>Upcoming: <span id='next'></span></div>
|
<div>Upcoming: <span id='next'></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='list0' style='float:left; width: 35%; height: 100%;'></div>
|
<div id='list0' style='float:left; width: 35%; height: 100%;'>
|
||||||
<div>Start: <span id='start'></span></div>
|
<div>Start: <span id='start'></span></div>
|
||||||
<div>End: <span id='end'></span></div>
|
<div>End: <span id='end'></span></div>
|
||||||
<div><span id='progressbar'></span> <span id='songposition'></span> | <span id='songlength'></span></div>
|
<div><span id='progressbar'></span> <span id='songposition'></span> | <span id='songlength'></span></div>
|
||||||
|
<div><span id='showprogressbar'></span> <span id='showposition'></span> | <span id='showlength'></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -225,6 +225,9 @@ install_setDirPermissions($CC_CONFIG["storageDir"]);
|
||||||
echo " * Importing sample audio clips \n";
|
echo " * Importing sample audio clips \n";
|
||||||
$command = __DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/null";
|
$command = __DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/null";
|
||||||
@exec($command, $output, $results);
|
@exec($command, $output, $results);
|
||||||
echo "****************************** Install Complete ******************************\n";
|
echo "****************************** Database Install Complete ******************************\n";
|
||||||
|
|
||||||
|
$command = "python ".__DIR__."/../pypo/install/pypo-install.py";
|
||||||
|
@exec($command, $output, $results);
|
||||||
|
//print_r($output);
|
||||||
?>
|
?>
|
|
@ -230,4 +230,7 @@ echo "************************************\n";
|
||||||
echo "* StorageServer Uninstall Complete *\n";
|
echo "* StorageServer Uninstall Complete *\n";
|
||||||
echo "************************************\n";
|
echo "************************************\n";
|
||||||
|
|
||||||
|
$command = "python ".__DIR__."/../pypo/install/pypo-uninstall.py";
|
||||||
|
@exec($command, $output, $results);
|
||||||
|
//print_r($output);
|
||||||
?>
|
?>
|
|
@ -11,7 +11,7 @@ function startDpSelect(dateText, inst) {
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
$("#end_date").datepicker("option", "minDate", date);
|
$("#add_show_end_date").datepicker("option", "minDate", date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function endDpSelect(dateText, inst) {
|
function endDpSelect(dateText, inst) {
|
||||||
|
@ -20,7 +20,7 @@ function endDpSelect(dateText, inst) {
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
$("#start_date").datepicker( "option", "maxDate", date);
|
$("#add_show_start_date").datepicker( "option", "maxDate", date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDateInput(el, onSelect) {
|
function createDateInput(el, onSelect) {
|
||||||
|
@ -38,13 +38,22 @@ function createDateInput(el, onSelect) {
|
||||||
|
|
||||||
function autoSelect(event, ui) {
|
function autoSelect(event, ui) {
|
||||||
|
|
||||||
$("#hosts-"+ui.item.value).attr("checked", "checked");
|
$("#add_show_hosts-"+ui.item.value).attr("checked", "checked");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function findHosts(request, callback) {
|
function findHosts(request, callback) {
|
||||||
var search = request.term;
|
var search, url;
|
||||||
|
|
||||||
|
url = "/User/get-hosts";
|
||||||
|
search = request.term;
|
||||||
|
|
||||||
|
$.post(url,
|
||||||
|
{format: "json", term: search},
|
||||||
|
|
||||||
|
function(json) {
|
||||||
|
callback(json.hosts);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,12 @@ var currentElem;
|
||||||
|
|
||||||
var updateInterval = 5000;
|
var updateInterval = 5000;
|
||||||
|
|
||||||
|
var songEndFunc;
|
||||||
|
|
||||||
|
function registerSongEndListener(func){
|
||||||
|
songEndFunc = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function convertToHHMMSS(timeInMS){
|
function convertToHHMMSS(timeInMS){
|
||||||
var time = parseInt(timeInMS);
|
var time = parseInt(timeInMS);
|
||||||
|
@ -70,7 +76,7 @@ function secondsTimer(){
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called every 1 second. */
|
/* Called every 0.2 seconds. */
|
||||||
function updateProgressBarValue(){
|
function updateProgressBarValue(){
|
||||||
if (estimatedSchedulePosixTime != -1){
|
if (estimatedSchedulePosixTime != -1){
|
||||||
if (currentSong.length > 0){
|
if (currentSong.length > 0){
|
||||||
|
@ -85,6 +91,11 @@ function updateProgressBarValue(){
|
||||||
}
|
}
|
||||||
$('#progressbar').progressBar(0);
|
$('#progressbar').progressBar(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
percentDone = (estimatedSchedulePosixTime - currentSong[0].showStartPosixTime)/currentSong[0].showLengthMs*100;
|
||||||
|
//$('#showprogressbar').text(currentSong[0].showLengthMs);
|
||||||
|
$('#showprogressbar').progressBar(percentDone);
|
||||||
} else {
|
} else {
|
||||||
$('#progressbar').progressBar(0);
|
$('#progressbar').progressBar(0);
|
||||||
|
|
||||||
|
@ -103,6 +114,8 @@ function updateProgressBarValue(){
|
||||||
function temp(){
|
function temp(){
|
||||||
currentSong[0] = nextSongs[0];
|
currentSong[0] = nextSongs[0];
|
||||||
updatePlaylist();
|
updatePlaylist();
|
||||||
|
|
||||||
|
songEndFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlaylist(){
|
function updatePlaylist(){
|
||||||
|
@ -111,40 +124,32 @@ function updatePlaylist(){
|
||||||
|
|
||||||
|
|
||||||
/* Column 1 update */
|
/* Column 1 update */
|
||||||
$('#show').empty();
|
|
||||||
$('#playlist').empty();
|
|
||||||
$('#host').empty();
|
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
//alert (currentSong[i].playlistname);
|
//alert (currentSong[i].playlistname);
|
||||||
//$('#show').append(currentSong[i].show);
|
//$('#show').text(currentSong[i].show);
|
||||||
$('#playlist').append(currentSong[i].playlistname);
|
$('#playlist').text(currentSong[i].name);
|
||||||
//$('#host').append(currentSong[i].creator);
|
//$('#host').text(currentSong[i].creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column 2 update */
|
/* Column 2 update */
|
||||||
$('#previous').empty();
|
|
||||||
$('#current').empty();
|
|
||||||
$('#next').empty();
|
|
||||||
for (var i=0; i<previousSongs.length; i++){
|
for (var i=0; i<previousSongs.length; i++){
|
||||||
$('#previous').append(getTrackInfo(previousSongs[i]));
|
$('#previous').text(getTrackInfo(previousSongs[i]));
|
||||||
}
|
}
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#current').append(getTrackInfo(currentSong[i]));
|
$('#current').text(getTrackInfo(currentSong[i]));
|
||||||
}
|
}
|
||||||
for (var i=0; i<nextSongs.length; i++){
|
for (var i=0; i<nextSongs.length; i++){
|
||||||
$('#next').append(getTrackInfo(nextSongs[i]));
|
$('#next').text(getTrackInfo(nextSongs[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column 3 update */
|
/* Column 3 update */
|
||||||
$('#start').empty();
|
|
||||||
$('#end').empty();
|
|
||||||
$('#songposition').empty();
|
|
||||||
$('#songlength').empty();
|
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#start').append(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#start').text(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
||||||
$('#end').append(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#end').text(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
|
||||||
$('#songposition').append(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].songStartPosixTime));
|
$('#songposition').text(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].songStartPosixTime));
|
||||||
$('#songlength').append(currentSong[i].clip_length);
|
$('#songlength').text(currentSong[i].clip_length);
|
||||||
|
$('#showposition').text(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].showStartPosixTime));
|
||||||
|
$('#showlength').text(convertToHHMMSS(currentSong[i].showEndPosixTime - currentSong[i].showStartPosixTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +158,10 @@ function calcAdditionalData(currentItem){
|
||||||
currentItem[i].songStartPosixTime = convertDateToPosixTime(currentItem[i].starts);
|
currentItem[i].songStartPosixTime = convertDateToPosixTime(currentItem[i].starts);
|
||||||
currentItem[i].songEndPosixTime = convertDateToPosixTime(currentItem[i].ends);
|
currentItem[i].songEndPosixTime = convertDateToPosixTime(currentItem[i].ends);
|
||||||
currentItem[i].songLengthMs = currentItem[i].songEndPosixTime - currentItem[i].songStartPosixTime;
|
currentItem[i].songLengthMs = currentItem[i].songEndPosixTime - currentItem[i].songStartPosixTime;
|
||||||
|
|
||||||
|
currentItem[i].showStartPosixTime = convertDateToPosixTime(currentItem[i].starts.substring(0, currentItem[i].starts.indexOf(" ")) + " " + currentItem[i].start_time);
|
||||||
|
currentItem[i].showEndPosixTime = convertDateToPosixTime(currentItem[i].starts.substring(0, currentItem[i].starts.indexOf(" ")) + " " + currentItem[i].end_time);
|
||||||
|
currentItem[i].showLengthMs = currentItem[i].showEndPosixTime - currentItem[i].showStartPosixTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +194,7 @@ function init(elemID) {
|
||||||
var currentElem = $("#" + elemID).attr("style", "z-index: 1; width: 100%; left: 0px; right: 0px; bottom: 0px; color: black; min-height: 100px; background-color: #FEF1B5;");
|
var currentElem = $("#" + elemID).attr("style", "z-index: 1; width: 100%; left: 0px; right: 0px; bottom: 0px; color: black; min-height: 100px; background-color: #FEF1B5;");
|
||||||
|
|
||||||
$('#progressbar').progressBar(0, {showText : false});
|
$('#progressbar').progressBar(0, {showText : false});
|
||||||
|
$('#showprogressbar').progressBar(0, {showText : false, barImage:'/js/progressbar/images/progressbg_red.gif'});
|
||||||
|
|
||||||
getScheduleFromServer();
|
getScheduleFromServer();
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
This tool was born out of a collaboration between Open Broadcast
|
||||||
|
and Sourcefabric. The authors of the code are:
|
||||||
|
|
||||||
|
Jonas Ohrstrom <jonas@digris.ch>
|
||||||
|
Paul Baranowski <paul.baranowski@sourcefabric.org>
|
||||||
|
Martin Konecny <martin.konecny@sourcefabric.org>
|
|
@ -54,10 +54,17 @@ def copy_dir(src_dir, dest_dir):
|
||||||
print "Copying directory "+src_dir+" to "+dest_dir
|
print "Copying directory "+src_dir+" to "+dest_dir
|
||||||
shutil.copytree(src_dir, dest_dir)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
try:
|
def get_current_script_dir():
|
||||||
|
current_script_dir = os.path.realpath(__file__)
|
||||||
|
index = current_script_dir.rindex('/')
|
||||||
|
print current_script_dir[0:index]
|
||||||
|
return current_script_dir[0:index]
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
current_script_dir = get_current_script_dir()
|
||||||
print "Terminating any existing pypo processes"
|
print "Terminating any existing pypo processes"
|
||||||
os.system("python ./pypo-stop.py")
|
os.system("python %s/pypo-stop.py"% current_script_dir)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
# Create users
|
# Create users
|
||||||
|
@ -79,19 +86,19 @@ try:
|
||||||
create_path(BASE_PATH+"archive")
|
create_path(BASE_PATH+"archive")
|
||||||
|
|
||||||
print "Copying pypo files"
|
print "Copying pypo files"
|
||||||
shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic")
|
shutil.copy("%s/../scripts/silence.mp3"%current_script_dir, BASE_PATH+"files/basic")
|
||||||
|
|
||||||
if platform.architecture()[0] == '64bit':
|
if platform.architecture()[0] == '64bit':
|
||||||
print "Installing 64-bit liquidsoap binary"
|
print "Installing 64-bit liquidsoap binary"
|
||||||
shutil.copy("../liquidsoap/liquidsoap64", "../liquidsoap/liquidsoap")
|
shutil.copy("%s/../liquidsoap/liquidsoap64"%current_script_dir, "%s/../liquidsoap/liquidsoap"%current_script_dir)
|
||||||
elif platform.architecture()[0] == '32bit':
|
elif platform.architecture()[0] == '32bit':
|
||||||
print "Installing 32-bit liquidsoap binary"
|
print "Installing 32-bit liquidsoap binary"
|
||||||
shutil.copy("../liquidsoap/liquidsoap32", "../liquidsoap/liquidsoap")
|
shutil.copy("%s/../liquidsoap/liquidsoap32"%current_script_dir, "%s/../liquidsoap/liquidsoap"%current_script_dir)
|
||||||
else:
|
else:
|
||||||
print "Unknown system architecture."
|
print "Unknown system architecture."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
copy_dir("..", BASE_PATH+"bin/")
|
copy_dir("%s/.."%current_script_dir, BASE_PATH+"bin/")
|
||||||
|
|
||||||
print "Setting permissions"
|
print "Setting permissions"
|
||||||
os.system("chmod -R 755 "+BASE_PATH)
|
os.system("chmod -R 755 "+BASE_PATH)
|
||||||
|
@ -100,30 +107,30 @@ try:
|
||||||
print "Installing daemontool script pypo-fetch"
|
print "Installing daemontool script pypo-fetch"
|
||||||
create_path("/etc/service/pypo-fetch")
|
create_path("/etc/service/pypo-fetch")
|
||||||
create_path("/etc/service/pypo-fetch/log")
|
create_path("/etc/service/pypo-fetch/log")
|
||||||
shutil.copy("pypo-daemontools-fetch.sh", "/etc/service/pypo-fetch/run")
|
shutil.copy("%s/pypo-daemontools-fetch.sh"%current_script_dir, "/etc/service/pypo-fetch/run")
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
shutil.copy("%s/pypo-daemontools-logger.sh"%current_script_dir, "/etc/service/pypo-fetch/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
|
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
|
||||||
|
|
||||||
print "Installing daemontool script pypo-push"
|
print "Installing daemontool script pypo-push"
|
||||||
create_path("/etc/service/pypo-push")
|
create_path("/etc/service/pypo-push")
|
||||||
create_path("/etc/service/pypo-push/log")
|
create_path("/etc/service/pypo-push/log")
|
||||||
shutil.copy("pypo-daemontools-push.sh", "/etc/service/pypo-push/run")
|
shutil.copy("%s/pypo-daemontools-push.sh"%current_script_dir, "/etc/service/pypo-push/run")
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
|
shutil.copy("%s/pypo-daemontools-logger.sh"%current_script_dir, "/etc/service/pypo-push/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-push")
|
os.system("chmod -R 755 /etc/service/pypo-push")
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-push")
|
os.system("chown -R pypo:pypo /etc/service/pypo-push")
|
||||||
|
|
||||||
print "Installing daemontool script pypo-liquidsoap"
|
print "Installing daemontool script pypo-liquidsoap"
|
||||||
create_path("/etc/service/pypo-liquidsoap")
|
create_path("/etc/service/pypo-liquidsoap")
|
||||||
create_path("/etc/service/pypo-liquidsoap/log")
|
create_path("/etc/service/pypo-liquidsoap/log")
|
||||||
shutil.copy("pypo-daemontools-liquidsoap.sh", "/etc/service/pypo-liquidsoap/run")
|
shutil.copy("%s/pypo-daemontools-liquidsoap.sh"%current_script_dir, "/etc/service/pypo-liquidsoap/run")
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
|
shutil.copy("%s/pypo-daemontools-logger.sh"%current_script_dir, "/etc/service/pypo-liquidsoap/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
|
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
|
||||||
|
|
||||||
print "Waiting for processes to start..."
|
print "Waiting for processes to start..."
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
os.system("python ./pypo-start.py")
|
os.system("python %s/pypo-start.py" % (get_current_script_dir()))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
found = True
|
found = True
|
||||||
|
|
|
@ -22,9 +22,14 @@ def remove_user(username):
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
os.system("deluser --remove-home " + username + " 1>/dev/null")
|
os.system("deluser --remove-home " + username + " 1>/dev/null")
|
||||||
|
|
||||||
|
def get_current_script_dir():
|
||||||
|
current_script_dir = os.path.realpath(__file__)
|
||||||
|
index = current_script_dir.rindex('/')
|
||||||
|
return current_script_dir[0:index]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.system("python ./pypo-stop.py")
|
os.system("python %s/pypo-stop.py" % get_current_script_dir())
|
||||||
|
|
||||||
print "Removing log directories"
|
print "Removing log directories"
|
||||||
remove_path("/var/log/pypo")
|
remove_path("/var/log/pypo")
|
||||||
|
|
Loading…
Reference in New Issue