-improved now-playing page
This commit is contained in:
parent
ac638c2e39
commit
c109fb5f01
7 changed files with 54 additions and 36 deletions
|
@ -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';
|
||||||
|
|
|
@ -111,7 +111,10 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
$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') {
|
||||||
|
|
||||||
|
|
|
@ -23,18 +23,18 @@ class Application_Model_Nowplaying
|
||||||
|
|
||||||
foreach ($previous as $item){
|
foreach ($previous as $item){
|
||||||
array_push($rows, array("p", $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" , $item["playlistname"]));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($current as $item){
|
foreach ($current as $item){
|
||||||
array_push($rows, array("c", $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" , $item["playlistname"]));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($next as $item){
|
foreach ($next as $item){
|
||||||
array_push($rows, array("n", $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" , $item["playlistname"]));
|
$item["album_title"], "x" , $item["name"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
||||||
|
|
|
@ -479,10 +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 *, 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.ends < TIMESTAMP '$timeNow')"
|
." WHERE (st.ends < 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 DESC"
|
." ORDER BY st.starts DESC"
|
||||||
." LIMIT $prevCount";
|
." LIMIT $prevCount";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
@ -492,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);
|
||||||
|
|
|
@ -49,10 +49,10 @@ function notifySongEnd(){
|
||||||
|
|
||||||
function createDataGrid(){
|
function createDataGrid(){
|
||||||
|
|
||||||
datagridData.columnHeaders[0]["fnRender"] = getDateText;
|
datagridData.columnHeaders[1]["fnRender"] = getDateText;
|
||||||
datagridData.columnHeaders[1]["fnRender"] = getTimeText;
|
|
||||||
datagridData.columnHeaders[2]["fnRender"] = getTimeText;
|
datagridData.columnHeaders[2]["fnRender"] = getTimeText;
|
||||||
datagridData.columnHeaders[3]["fnRender"] = changeTimePrecisionInit;
|
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( {
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -76,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){
|
||||||
|
@ -91,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);
|
||||||
|
|
||||||
|
@ -119,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue