cc-2167-top-panel-doesn't-list-recording-shows
This commit is contained in:
parent
b9c1f7356f
commit
bc640d38f2
9 changed files with 302 additions and 139 deletions
|
@ -71,8 +71,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript');
|
||||||
|
|
||||||
//scripts for now playing bar
|
//scripts for now playing bar
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/playlist/helperfunctions.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/playlist/playlist.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript');
|
||||||
|
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript');
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,8 +113,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$result = Schedule::GetPlayOrderRange(0, 1);
|
|
||||||
|
|
||||||
$date = new DateHelper;
|
$date = new DateHelper;
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $date->getTimestamp();
|
||||||
$result = array("env"=>APPLICATION_ENV,
|
$result = array("env"=>APPLICATION_ENV,
|
||||||
|
|
22
airtime_mvc/application/controllers/DashboardController.php
Normal file
22
airtime_mvc/application/controllers/DashboardController.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class DashboardController extends Zend_Controller_Action
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
// action body
|
||||||
|
}
|
||||||
|
|
||||||
|
public function helpAction()
|
||||||
|
{
|
||||||
|
// action body
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
115
airtime_mvc/application/models/Dashboard.php
Normal file
115
airtime_mvc/application/models/Dashboard.php
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Model_Dashboard
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function GetPreviousItem($p_timeNow){
|
||||||
|
//get previous show and previous item in the schedule table.
|
||||||
|
//Compare the two and if the last show was recorded and started
|
||||||
|
//after the last item in the schedule table, then return the show's
|
||||||
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
|
$showInstance = ShowInstance::GetLastShowInstance($p_timeNow);
|
||||||
|
$row = Schedule::GetLastScheduleItem($p_timeNow);
|
||||||
|
|
||||||
|
if (is_null($showInstance)){
|
||||||
|
if (count($row) == 0){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
//should never reach here. Doesnt make sense to have
|
||||||
|
//a schedule item not within a show_instance.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (count($row) == 0){
|
||||||
|
//last item is a show instance
|
||||||
|
return array("name"=>$showInstance->getName(),
|
||||||
|
"starts"=>$showInstance->getShowStart(),
|
||||||
|
"ends"=>$showInstance->getShowEnd());
|
||||||
|
} else {
|
||||||
|
//return the one that started later.
|
||||||
|
if ($row[0]["starts"] >= $showInstance->getShowStart()){
|
||||||
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
|
"starts"=>$row[0]["starts"],
|
||||||
|
"ends"=>$row[0]["ends"]);
|
||||||
|
} else {
|
||||||
|
return array("name"=>$showInstance->getName(),
|
||||||
|
"starts"=>$showInstance->getShowStart(),
|
||||||
|
"ends"=>$showInstance->getShowEnd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetCurrentItem($p_timeNow){
|
||||||
|
//get previous show and previous item in the schedule table.
|
||||||
|
//Compare the two and if the last show was recorded and started
|
||||||
|
//after the last item in the schedule table, then return the show's
|
||||||
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
|
$showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow);
|
||||||
|
$row = Schedule::GetCurrentScheduleItem($p_timeNow);
|
||||||
|
|
||||||
|
if (is_null($showInstance)){
|
||||||
|
if (count($row) == 0){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
//should never reach here. Doesnt make sense to have
|
||||||
|
//a schedule item not within a show_instance.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (count($row) == 0){
|
||||||
|
//last item is a show instance
|
||||||
|
return array("name"=>$showInstance->getName(),
|
||||||
|
"starts"=>$showInstance->getShowStart(),
|
||||||
|
"ends"=>$showInstance->getShowEnd(),
|
||||||
|
"media_item_played"=>false, //TODO
|
||||||
|
"record"=>$showInstance->isRecorded()); //TODO
|
||||||
|
} else {
|
||||||
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
|
"starts"=>$row[0]["starts"],
|
||||||
|
"ends"=>$row[0]["ends"],
|
||||||
|
"media_item_played"=>$row[0]["media_item_played"],
|
||||||
|
"record"=>0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetNextItem($p_timeNow){
|
||||||
|
//get previous show and previous item in the schedule table.
|
||||||
|
//Compare the two and if the last show was recorded and started
|
||||||
|
//after the last item in the schedule table, then return the show's
|
||||||
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
|
$showInstance = ShowInstance::GetNextShowInstance($p_timeNow);
|
||||||
|
$row = Schedule::GetNextScheduleItem($p_timeNow);
|
||||||
|
|
||||||
|
if (is_null($showInstance)){
|
||||||
|
if (count($row) == 0){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
//should never reach here. Doesnt make sense to have
|
||||||
|
//a schedule item not within a show_instance.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (count($row) == 0){
|
||||||
|
//last item is a show instance
|
||||||
|
return array("name"=>$showInstance->getName(),
|
||||||
|
"starts"=>$showInstance->getShowStart(),
|
||||||
|
"ends"=>$showInstance->getShowEnd());
|
||||||
|
} else {
|
||||||
|
//return the one that starts sooner.
|
||||||
|
|
||||||
|
if ($row[0]["starts"] <= $showInstance->getShowStart()){
|
||||||
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
|
"starts"=>$row[0]["starts"],
|
||||||
|
"ends"=>$row[0]["ends"]);
|
||||||
|
} else {
|
||||||
|
return array("name"=>$showInstance->getName(),
|
||||||
|
"starts"=>$showInstance->getShowStart(),
|
||||||
|
"ends"=>$showInstance->getShowEnd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -365,9 +365,12 @@ class Schedule {
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $date->getTimestamp();
|
||||||
return array("env"=>APPLICATION_ENV,
|
return array("env"=>APPLICATION_ENV,
|
||||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||||
"previous"=>Schedule::GetScheduledItemData($timeNow, -1, $prev, "24 hours"),
|
//"previous"=>Schedule::GetScheduledItemData($timeNow, -1, $prev, "24 hours"),
|
||||||
"current"=>Schedule::GetScheduledItemData($timeNow, 0),
|
//"current"=>Schedule::GetScheduledItemData($timeNow, 0),
|
||||||
"next"=>Schedule::GetScheduledItemData($timeNow, 1, $next, "48 hours"),
|
//"next"=>Schedule::GetScheduledItemData($timeNow, 1, $next, "48 hours"),
|
||||||
|
"previous"=>Application_Model_Dashboard::GetPreviousItem($timeNow),
|
||||||
|
"current"=>Application_Model_Dashboard::GetCurrentItem($timeNow),
|
||||||
|
"next"=>Application_Model_Dashboard::GetNextItem($timeNow),
|
||||||
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
||||||
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
|
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
|
||||||
"timezone"=> date("T"),
|
"timezone"=> date("T"),
|
||||||
|
@ -375,6 +378,52 @@ class Schedule {
|
||||||
"apiKey"=>$CC_CONFIG['apiKey'][0]);
|
"apiKey"=>$CC_CONFIG['apiKey'][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetLastScheduleItem($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT *"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
|
." ON st.file_id = ft.id"
|
||||||
|
." WHERE st.ends < TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY st.ends DESC"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$row = $CC_DBC->GetAll($sql);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function GetCurrentScheduleItem($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT *"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
|
." ON st.file_id = ft.id"
|
||||||
|
." WHERE st.starts <= TIMESTAMP '$p_timeNow'"
|
||||||
|
." AND st.ends > TIMESTAMP '$p_timeNow'"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$row = $CC_DBC->GetAll($sql);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetNextScheduleItem($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT *"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
|
." ON st.file_id = ft.id"
|
||||||
|
." WHERE st.starts > TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY st.starts"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$row = $CC_DBC->GetAll($sql);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds an SQL Query for accessing scheduled item information from
|
* Builds an SQL Query for accessing scheduled item information from
|
||||||
* the database.
|
* the database.
|
||||||
|
|
|
@ -1718,6 +1718,57 @@ class ShowInstance {
|
||||||
|
|
||||||
return ($diff < 0) ? 0 : $diff;
|
return ($diff < 0) ? 0 : $diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetLastShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY si.ends DESC"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetCurrentShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.starts <= TIMESTAMP '$p_timeNow'"
|
||||||
|
." AND si.ends > TIMESTAMP '$p_timeNow'"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetNextShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.starts > TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY si.starts"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show Data Access Layer */
|
/* Show Data Access Layer */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
var estimatedSchedulePosixTime = null;
|
var estimatedSchedulePosixTime = null;
|
||||||
var localRemoteTimeOffset = null;
|
var localRemoteTimeOffset = null;
|
||||||
|
|
||||||
var previousSongs = new Array();
|
var previousSong = null;
|
||||||
var currentSong = new Array();
|
var currentSong = null;
|
||||||
var nextSongs = new Array();
|
var nextSong = null;
|
||||||
|
|
||||||
var currentShow = new Array();
|
var currentShow = new Array();
|
||||||
var nextShow = new Array();
|
var nextShow = new Array();
|
||||||
|
@ -25,21 +25,8 @@ var nextShowPrepare = true;
|
||||||
|
|
||||||
var apiKey = "";
|
var apiKey = "";
|
||||||
|
|
||||||
function getTrackInfo(song){
|
|
||||||
var str = "";
|
|
||||||
|
|
||||||
if (song.track_title != null)
|
|
||||||
str += song.track_title;
|
|
||||||
if (song.artist_name != null)
|
|
||||||
str += " - " + song.artist_name;
|
|
||||||
|
|
||||||
str += ","
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function secondsTimer(){
|
function secondsTimer(){
|
||||||
if (localRemoteTimeOffset != null){
|
if (localRemoteTimeOffset !== null){
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
|
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
|
@ -50,7 +37,8 @@ function secondsTimer(){
|
||||||
|
|
||||||
function newSongStart(){
|
function newSongStart(){
|
||||||
nextSongPrepare = true;
|
nextSongPrepare = true;
|
||||||
currentSong[0] = nextSongs.shift();
|
currentSong = nextSong;
|
||||||
|
nextSong = null;
|
||||||
|
|
||||||
if (typeof notifySongStart == "function")
|
if (typeof notifySongStart == "function")
|
||||||
notifySongStart();
|
notifySongStart();
|
||||||
|
@ -80,13 +68,13 @@ function updateProgressBarValue(){
|
||||||
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
||||||
|
|
||||||
var songPercentDone = 0;
|
var songPercentDone = 0;
|
||||||
if (currentSong.length > 0){
|
if (currentSong !== null){
|
||||||
songPercentDone = (estimatedSchedulePosixTime - currentSong[0].songStartPosixTime)/currentSong[0].songLengthMs*100;
|
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||||
if (songPercentDone < 0 || songPercentDone > 100){
|
if (songPercentDone < 0 || songPercentDone > 100){
|
||||||
songPercentDone = 0;
|
songPercentDone = 0;
|
||||||
currentSong = new Array();
|
currentSong = null;
|
||||||
} else {
|
} else {
|
||||||
if (currentSong[0].media_item_played == "t" && currentShow.length > 0)
|
if (currentSong.media_item_played == "t" && currentShow.length > 0)
|
||||||
$('#on-air-info').attr("class", "on-air-info on");
|
$('#on-air-info').attr("class", "on-air-info on");
|
||||||
else
|
else
|
||||||
$('#on-air-info').attr("class", "on-air-info off");
|
$('#on-air-info').attr("class", "on-air-info off");
|
||||||
|
@ -99,8 +87,8 @@ function updateProgressBarValue(){
|
||||||
$('#progress-bar').attr("style", "width:"+songPercentDone+"%");
|
$('#progress-bar').attr("style", "width:"+songPercentDone+"%");
|
||||||
|
|
||||||
//calculate how much time left to next song if there is any
|
//calculate how much time left to next song if there is any
|
||||||
if (nextSongs.length > 0 && nextSongPrepare){
|
if (nextSong !== null && nextSongPrepare){
|
||||||
var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime;
|
var diff = nextSong.songStartPosixTime - estimatedSchedulePosixTime;
|
||||||
if (diff < serverUpdateInterval){
|
if (diff < serverUpdateInterval){
|
||||||
|
|
||||||
//sometimes the diff is negative (-100ms for example). Still looking
|
//sometimes the diff is negative (-100ms for example). Still looking
|
||||||
|
@ -133,20 +121,26 @@ function updatePlaybar(){
|
||||||
$('#current').html("Current: <span style='color:red; font-weight:bold'>Nothing Scheduled</span>");
|
$('#current').html("Current: <span style='color:red; font-weight:bold'>Nothing Scheduled</span>");
|
||||||
$('#next').empty();
|
$('#next').empty();
|
||||||
$('#next-length').empty();
|
$('#next-length').empty();
|
||||||
if (previousSongs.length > 0){
|
if (previousSong !== null){
|
||||||
$('#previous').text(getTrackInfo(previousSongs[previousSongs.length-1]));
|
$('#previous').text(previousSong.name+",");
|
||||||
$('#prev-length').text(convertToHHMMSSmm(previousSongs[previousSongs.length-1].songLengthMs));
|
$('#prev-length').text(convertToHHMMSSmm(previousSong.songLengthMs));
|
||||||
}
|
}
|
||||||
if (currentSong.length > 0){
|
if (currentSong !== null){
|
||||||
$('#current').text(getTrackInfo(currentSong[0]));
|
if (currentSong.record == "1")
|
||||||
} else if (currentShow.length > 0){
|
$('#current').html("<span style='color:red; font-weight:bold'>Recording: </span>"+currentSong.name+",");
|
||||||
|
else
|
||||||
|
$('#current').text(currentSong.name+",");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else if (currentShow.length > 0){
|
||||||
if (currentShow[0].record == "1"){
|
if (currentShow[0].record == "1"){
|
||||||
$('#current').html("Current: <span style='color:red; font-weight:bold'>Recording</span>");
|
$('#current').html("Current: <span style='color:red; font-weight:bold'>Recording</span>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nextSongs.length > 0){
|
* */
|
||||||
$('#next').text(getTrackInfo(nextSongs[0]));
|
if (nextSong !== null){
|
||||||
$('#next-length').text(convertToHHMMSSmm(nextSongs[0].songLengthMs));
|
$('#next').text(nextSong.name+",");
|
||||||
|
$('#next-length').text(convertToHHMMSSmm(nextSong.songLengthMs));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#start').empty();
|
$('#start').empty();
|
||||||
|
@ -154,18 +148,18 @@ function updatePlaybar(){
|
||||||
$('#time-elapsed').empty();
|
$('#time-elapsed').empty();
|
||||||
$('#time-remaining').empty();
|
$('#time-remaining').empty();
|
||||||
$('#song-length').empty();
|
$('#song-length').empty();
|
||||||
for (var i=0; i<currentSong.length; i++){
|
if (currentSong !== null){
|
||||||
$('#start').text(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#start').text(currentSong.starts.substring(currentSong.starts.indexOf(" ")+1));
|
||||||
$('#end').text(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#end').text(currentSong.ends.substring(currentSong.starts.indexOf(" ")+1));
|
||||||
|
|
||||||
/* Get rid of the millisecond accuracy so that the second counters for both
|
/* Get rid of the millisecond accuracy so that the second counters for both
|
||||||
* show and song change at the same time. */
|
* show and song change at the same time. */
|
||||||
var songStartRoughly = parseInt(Math.round(currentSong[i].songStartPosixTime/1000))*1000;
|
var songStartRoughly = parseInt(Math.round(currentSong.songStartPosixTime/1000))*1000;
|
||||||
var songEndRoughly = parseInt(Math.round(currentSong[i].songEndPosixTime/1000))*1000;
|
var songEndRoughly = parseInt(Math.round(currentSong.songEndPosixTime/1000))*1000;
|
||||||
|
|
||||||
$('#time-elapsed').text(convertToHHMMSS(estimatedSchedulePosixTime - songStartRoughly));
|
$('#time-elapsed').text(convertToHHMMSS(estimatedSchedulePosixTime - songStartRoughly));
|
||||||
$('#time-remaining').text(convertToHHMMSS(songEndRoughly - estimatedSchedulePosixTime));
|
$('#time-remaining').text(convertToHHMMSS(songEndRoughly - estimatedSchedulePosixTime));
|
||||||
$('#song-length').text(convertToHHMMSSmm(currentSong[i].songLengthMs));
|
$('#song-length').text(convertToHHMMSSmm(currentSong.songLengthMs));
|
||||||
}
|
}
|
||||||
/* Column 1 update */
|
/* Column 1 update */
|
||||||
$('#playlist').text("Current Show:");
|
$('#playlist').text("Current Show:");
|
||||||
|
@ -187,11 +181,9 @@ function updatePlaybar(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcAdditionalData(currentItem){
|
function calcAdditionalData(currentItem){
|
||||||
for (var i=0; i<currentItem.length; i++){
|
currentItem.songStartPosixTime = convertDateToPosixTime(currentItem.starts);
|
||||||
currentItem[i].songStartPosixTime = convertDateToPosixTime(currentItem[i].starts);
|
currentItem.songEndPosixTime = convertDateToPosixTime(currentItem.ends);
|
||||||
currentItem[i].songEndPosixTime = convertDateToPosixTime(currentItem[i].ends);
|
currentItem.songLengthMs = currentItem.songEndPosixTime - currentItem.songStartPosixTime;
|
||||||
currentItem[i].songLengthMs = currentItem[i].songEndPosixTime - currentItem[i].songStartPosixTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcAdditionalShowData(show){
|
function calcAdditionalShowData(show){
|
||||||
|
@ -208,17 +200,18 @@ function parseItems(obj){
|
||||||
|
|
||||||
$('#time-zone').text(obj.timezone);
|
$('#time-zone').text(obj.timezone);
|
||||||
|
|
||||||
previousSongs = obj.previous;
|
previousSong = obj.previous;
|
||||||
nextSongs = obj.next;
|
currentSong = obj.current;
|
||||||
|
nextSong = obj.next;
|
||||||
|
|
||||||
calcAdditionalData(previousSongs);
|
if (previousSong !== null)
|
||||||
calcAdditionalData(nextSongs);
|
calcAdditionalData(previousSong);
|
||||||
|
if (currentSong !== null)
|
||||||
|
calcAdditionalData(currentSong);
|
||||||
|
if (nextSong !== null)
|
||||||
|
calcAdditionalData(nextSong);
|
||||||
|
|
||||||
currentShow = obj.currentShow;
|
currentShow = obj.currentShow;
|
||||||
if(currentShow.length > 0){
|
|
||||||
currentSong = obj.current;
|
|
||||||
calcAdditionalData(currentSong);
|
|
||||||
}
|
|
||||||
nextShow = obj.nextShow;
|
nextShow = obj.nextShow;
|
||||||
|
|
||||||
calcAdditionalShowData(obj.currentShow);
|
calcAdditionalShowData(obj.currentShow);
|
||||||
|
@ -238,17 +231,10 @@ function getScheduleFromServer(){
|
||||||
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupQtip(){
|
||||||
function init() {
|
|
||||||
//begin producer "thread"
|
|
||||||
getScheduleFromServer();
|
|
||||||
|
|
||||||
//begin consumer "thread"
|
|
||||||
secondsTimer();
|
|
||||||
|
|
||||||
var qtipElem = $('#about-link');
|
var qtipElem = $('#about-link');
|
||||||
|
|
||||||
if (qtipElem.length > 0)
|
if (qtipElem.length > 0){
|
||||||
qtipElem.qtip({
|
qtipElem.qtip({
|
||||||
content: $('#about-txt').html(),
|
content: $('#about-txt').html(),
|
||||||
show: 'mouseover',
|
show: 'mouseover',
|
||||||
|
@ -267,6 +253,17 @@ function init() {
|
||||||
name: 'light' // Use the default light style
|
name: 'light' // Use the default light style
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
//begin producer "thread"
|
||||||
|
getScheduleFromServer();
|
||||||
|
|
||||||
|
//begin consumer "thread"
|
||||||
|
secondsTimer();
|
||||||
|
|
||||||
|
setupQtip();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
|
@ -1,69 +0,0 @@
|
||||||
function createDataGrid(datagridData){
|
|
||||||
|
|
||||||
var columnHeaders = [
|
|
||||||
{ "sTitle": "name" },
|
|
||||||
{ "sTitle": "date" },
|
|
||||||
{ "sTitle": "start time" },
|
|
||||||
{ "sTitle": "end time" }
|
|
||||||
];
|
|
||||||
|
|
||||||
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" width="100%" id="nowplayingtable"></table>' );
|
|
||||||
$('#nowplayingtable').dataTable( {
|
|
||||||
"bSort" : false,
|
|
||||||
"bJQueryUI": true,
|
|
||||||
"bFilter": false,
|
|
||||||
"bInfo": false,
|
|
||||||
"bLengthChange": false,
|
|
||||||
"aaData": datagridData.rows,
|
|
||||||
"aoColumns": columnHeaders
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
var options1 = [
|
|
||||||
|
|
||||||
{title:"Menu Item 1 - Go TO www.google.com", action:{type:"gourl",url:"http://www.google.com/"}},
|
|
||||||
{title:"Menu Item 2 - do <b style='color:red;'>nothing</b>"},
|
|
||||||
{title:"Menu Item 3 - submenu", type:"sub", src:[{title:"Submenu 1"},{title:"Submenu 2"},{title:"Submenu 3"}, {title:"Submenu 4 - submenu", type:"sub", src:[{title:"SubSubmenu 1"},{title:"SubSubmenu 2"}]}]},
|
|
||||||
{title:"Menu Item 4 - Js function", action:{type:"fn",callback:"(function(){ alert('THIS IS THE TEST'); })"}}
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
var userData = {};
|
|
||||||
|
|
||||||
var effects = {
|
|
||||||
show:"default", //type of show effect
|
|
||||||
orientation: "auto", //type of menu orientation - to top, to bottom, auto (to bottom, if doesn't fit on screen - to top)
|
|
||||||
xposition:"mouse", // position of menu (left side or right side of trigger element)
|
|
||||||
yposition:"mouse"
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#demo').jjmenu('both', options1, userData, effects );
|
|
||||||
}
|
|
||||||
|
|
||||||
function initShowListView(){
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({ url: "/Schedule/get-show-data/format/json", dataType:"text", success:function(data){
|
|
||||||
$('#json-string').text(data);
|
|
||||||
}});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({ url: "/Schedule/get-show-data/format/json", dataType:"json", success:function(data){
|
|
||||||
var temp = data.data;
|
|
||||||
var rows = new Array();
|
|
||||||
for (var i=0; i<temp.length; i++){
|
|
||||||
rows[i] = [temp[i].name.toString(), temp[i].first_show.toString(), temp[i].start_time.toString(), temp[i].end_time.toString()];
|
|
||||||
var datagridData = {rows:rows};
|
|
||||||
createDataGrid(datagridData);
|
|
||||||
}
|
|
||||||
}});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//setTimeout(initShowListView, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
initShowListView();
|
|
||||||
});
|
|
Loading…
Add table
Add a link
Reference in a new issue