Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
be4d3f5466
4 changed files with 213 additions and 207 deletions
|
@ -54,6 +54,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$view->headScript()->appendFile('/js/libs/jquery-1.4.4.min.js','text/javascript');
|
$view->headScript()->appendFile('/js/libs/jquery-1.4.4.min.js','text/javascript');
|
||||||
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.8.custom.min.js','text/javascript');
|
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.8.custom.min.js','text/javascript');
|
||||||
$view->headScript()->appendFile('/js/libs/stuHover.js','text/javascript');
|
$view->headScript()->appendFile('/js/libs/stuHover.js','text/javascript');
|
||||||
|
$view->headScript()->appendFile('/js/playlist/helperfunctions.js','text/javascript');
|
||||||
$view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
|
$view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,15 @@ $pages = array(
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Schedule',
|
'label' => 'Schedule',
|
||||||
'module' => 'default',
|
'uri' => 'javascript:void(null)',
|
||||||
'controller' => 'Schedule',
|
|
||||||
'action' => 'index',
|
|
||||||
'resource' => 'schedule',
|
|
||||||
'pages' => array(
|
'pages' => array(
|
||||||
|
array(
|
||||||
|
'label' => 'View',
|
||||||
|
'module' => 'default',
|
||||||
|
'controller' => 'Schedule',
|
||||||
|
'action' => 'index',
|
||||||
|
'resource' => 'schedule'
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Add Show',
|
'label' => 'Add Show',
|
||||||
'module' => 'default',
|
'module' => 'default',
|
||||||
|
@ -55,8 +59,7 @@ $pages = array(
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Configure',
|
'label' => 'Configure',
|
||||||
'module' => 'default',
|
'uri' => 'javascript:void(null)',
|
||||||
'controller' => 'Nowplaying',
|
|
||||||
'pages' => array(
|
'pages' => array(
|
||||||
array(
|
array(
|
||||||
'label' => 'Preferences',
|
'label' => 'Preferences',
|
||||||
|
|
98
public/js/playlist/helperfunctions.js
Normal file
98
public/js/playlist/helperfunctions.js
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/* Takes an input parameter of milliseconds and converts these into
|
||||||
|
* the format HH:MM:SS */
|
||||||
|
function convertToHHMMSS(timeInMS){
|
||||||
|
var time = parseInt(timeInMS);
|
||||||
|
|
||||||
|
var hours = parseInt(time / 3600000);
|
||||||
|
time -= 3600000*hours;
|
||||||
|
|
||||||
|
var minutes = parseInt(time / 60000);
|
||||||
|
time -= 60000*minutes;
|
||||||
|
|
||||||
|
var seconds = parseInt(time / 1000);
|
||||||
|
|
||||||
|
hours = hours.toString();
|
||||||
|
minutes = minutes.toString();
|
||||||
|
seconds = seconds.toString();
|
||||||
|
|
||||||
|
if (hours.length == 1)
|
||||||
|
hours = "0" + hours;
|
||||||
|
if (minutes.length == 1)
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
if (seconds.length == 1)
|
||||||
|
seconds = "0" + seconds;
|
||||||
|
if (hours == "00")
|
||||||
|
return minutes + ":" + seconds;
|
||||||
|
else
|
||||||
|
return "" + hours + ":" + minutes + ":" + seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertToHHMMSSmm(timeInMS){
|
||||||
|
var time = parseInt(timeInMS);
|
||||||
|
|
||||||
|
var hours = parseInt(time / 3600000);
|
||||||
|
time -= 3600000*hours;
|
||||||
|
|
||||||
|
var minutes = parseInt(time / 60000);
|
||||||
|
time -= 60000*minutes;
|
||||||
|
|
||||||
|
var seconds = parseInt(time / 1000);
|
||||||
|
time -= 1000*seconds;
|
||||||
|
|
||||||
|
var ms = parseInt(time);
|
||||||
|
|
||||||
|
hours = hours.toString();
|
||||||
|
minutes = minutes.toString();
|
||||||
|
seconds = seconds.toString();
|
||||||
|
ms = ms.toString();
|
||||||
|
|
||||||
|
if (hours.length == 1)
|
||||||
|
hours = "0" + hours;
|
||||||
|
if (minutes.length == 1)
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
if (seconds.length == 1)
|
||||||
|
seconds = "0" + seconds;
|
||||||
|
|
||||||
|
if (ms.length == 3)
|
||||||
|
ms = ms.substring(0, 2);
|
||||||
|
else if (ms.length == 2)
|
||||||
|
ms = "0" + ms.substring(0,1);
|
||||||
|
else if (ms.length == 1)
|
||||||
|
ms = "00";
|
||||||
|
|
||||||
|
if (hours == "00")
|
||||||
|
return minutes + ":" + seconds + "." + ms;
|
||||||
|
else
|
||||||
|
return "" + hours + ":" + minutes + ":" + seconds+ "." + ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertDateToHHMMSS(epochTime){
|
||||||
|
var d = new Date(epochTime);
|
||||||
|
|
||||||
|
var hours = d.getUTCHours().toString();
|
||||||
|
var minutes = d.getUTCMinutes().toString();
|
||||||
|
var seconds = d.getUTCSeconds().toString();
|
||||||
|
|
||||||
|
if (hours.length == 1)
|
||||||
|
hours = "0" + hours;
|
||||||
|
if (minutes.length == 1)
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
if (seconds.length == 1)
|
||||||
|
seconds = "0" + seconds;
|
||||||
|
return "" + hours + ":" + minutes + ":" + seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertDateToPosixTime(s){
|
||||||
|
var year = s.substring(0, 4);
|
||||||
|
var month = s.substring(5, 7);
|
||||||
|
var day = s.substring(8, 10);
|
||||||
|
var hour = s.substring(11, 13);
|
||||||
|
var minute = s.substring(14, 16);
|
||||||
|
var sec = s.substring(17, 19);
|
||||||
|
var msec = 0;
|
||||||
|
if (s.length >= 20){
|
||||||
|
msec = s.substring(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Date.UTC(year, month, day, hour, minute, sec, msec);
|
||||||
|
}
|
|
@ -25,132 +25,36 @@ var nextSongPrepare = true;
|
||||||
/* Another script can register its function here
|
/* Another script can register its function here
|
||||||
* when it wishes to know when a song ends. */
|
* when it wishes to know when a song ends. */
|
||||||
function registerSongEndListener(func){
|
function registerSongEndListener(func){
|
||||||
songEndFunc = func;
|
songEndFunc = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifySongEndListener(){
|
function notifySongEndListener(){
|
||||||
if (typeof songEndFunc == "function")
|
if (typeof songEndFunc == "function"){
|
||||||
songEndFunc();
|
//create a slight pause in execution to allow the browser
|
||||||
}
|
//to update the display.
|
||||||
|
setTimeout(songEndFunc, 50);
|
||||||
/* Takes an input parameter of milliseconds and converts these into
|
}
|
||||||
* the format HH:MM:SS */
|
|
||||||
function convertToHHMMSS(timeInMS){
|
|
||||||
var time = parseInt(timeInMS);
|
|
||||||
|
|
||||||
var hours = parseInt(time / 3600000);
|
|
||||||
time -= 3600000*hours;
|
|
||||||
|
|
||||||
var minutes = parseInt(time / 60000);
|
|
||||||
time -= 60000*minutes;
|
|
||||||
|
|
||||||
var seconds = parseInt(time / 1000);
|
|
||||||
|
|
||||||
hours = hours.toString();
|
|
||||||
minutes = minutes.toString();
|
|
||||||
seconds = seconds.toString();
|
|
||||||
|
|
||||||
if (hours.length == 1)
|
|
||||||
hours = "0" + hours;
|
|
||||||
if (minutes.length == 1)
|
|
||||||
minutes = "0" + minutes;
|
|
||||||
if (seconds.length == 1)
|
|
||||||
seconds = "0" + seconds;
|
|
||||||
if (hours == "00")
|
|
||||||
return minutes + ":" + seconds;
|
|
||||||
else
|
|
||||||
return "" + hours + ":" + minutes + ":" + seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
function convertToHHMMSSmm(timeInMS){
|
|
||||||
var time = parseInt(timeInMS);
|
|
||||||
|
|
||||||
var hours = parseInt(time / 3600000);
|
|
||||||
time -= 3600000*hours;
|
|
||||||
|
|
||||||
var minutes = parseInt(time / 60000);
|
|
||||||
time -= 60000*minutes;
|
|
||||||
|
|
||||||
var seconds = parseInt(time / 1000);
|
|
||||||
time -= 1000*seconds;
|
|
||||||
|
|
||||||
var ms = parseInt(time);
|
|
||||||
|
|
||||||
hours = hours.toString();
|
|
||||||
minutes = minutes.toString();
|
|
||||||
seconds = seconds.toString();
|
|
||||||
ms = ms.toString();
|
|
||||||
|
|
||||||
if (hours.length == 1)
|
|
||||||
hours = "0" + hours;
|
|
||||||
if (minutes.length == 1)
|
|
||||||
minutes = "0" + minutes;
|
|
||||||
if (seconds.length == 1)
|
|
||||||
seconds = "0" + seconds;
|
|
||||||
|
|
||||||
if (ms.length == 3)
|
|
||||||
ms = ms.substring(0, 2);
|
|
||||||
else if (ms.length == 2)
|
|
||||||
ms = "0" + ms.substring(0,1);
|
|
||||||
else if (ms.length == 1)
|
|
||||||
ms = "00";
|
|
||||||
|
|
||||||
if (hours == "00")
|
|
||||||
return minutes + ":" + seconds + "." + ms;
|
|
||||||
else
|
|
||||||
return "" + hours + ":" + minutes + ":" + seconds+ "." + ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
function convertDateToHHMMSS(epochTime){
|
|
||||||
var d = new Date(epochTime);
|
|
||||||
|
|
||||||
var hours = d.getUTCHours().toString();
|
|
||||||
var minutes = d.getUTCMinutes().toString();
|
|
||||||
var seconds = d.getUTCSeconds().toString();
|
|
||||||
|
|
||||||
if (hours.length == 1)
|
|
||||||
hours = "0" + hours;
|
|
||||||
if (minutes.length == 1)
|
|
||||||
minutes = "0" + minutes;
|
|
||||||
if (seconds.length == 1)
|
|
||||||
seconds = "0" + seconds;
|
|
||||||
return "" + hours + ":" + minutes + ":" + seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
function convertDateToPosixTime(s){
|
|
||||||
var year = s.substring(0, 4);
|
|
||||||
var month = s.substring(5, 7);
|
|
||||||
var day = s.substring(8, 10);
|
|
||||||
var hour = s.substring(11, 13);
|
|
||||||
var minute = s.substring(14, 16);
|
|
||||||
var sec = s.substring(17, 19);
|
|
||||||
var msec = 0;
|
|
||||||
if (s.length >= 20){
|
|
||||||
msec = s.substring(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Date.UTC(year, month, day, hour, minute, sec, msec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrackInfo(song){
|
function getTrackInfo(song){
|
||||||
var str = "";
|
var str = "";
|
||||||
|
|
||||||
if (song.track_title != null)
|
if (song.track_title != null)
|
||||||
str += song.track_title;
|
str += song.track_title;
|
||||||
if (song.artist_name != null)
|
if (song.artist_name != null)
|
||||||
str += " - " + song.artist_name;
|
str += " - " + song.artist_name;
|
||||||
//if (song.album_title != null)
|
//if (song.album_title != null)
|
||||||
//str += " - " + song.album_title;
|
//str += " - " + song.album_title;
|
||||||
|
|
||||||
str += ","
|
str += ","
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function secondsTimer(){
|
function secondsTimer(){
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
|
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateGlobalValues(obj){
|
function updateGlobalValues(obj){
|
||||||
|
@ -161,7 +65,7 @@ function updateGlobalValues(obj){
|
||||||
|
|
||||||
function newSongStart(){
|
function newSongStart(){
|
||||||
nextSongPrepare = true;
|
nextSongPrepare = true;
|
||||||
currentSong[0] = nextSongs.shift();
|
currentSong[0] = nextSongs.shift();
|
||||||
updateGlobalValues(currentSong[0]);
|
updateGlobalValues(currentSong[0]);
|
||||||
updatePlaybar();
|
updatePlaybar();
|
||||||
|
|
||||||
|
@ -170,26 +74,26 @@ function newSongStart(){
|
||||||
|
|
||||||
/* Called every "uiUpdateInterval" mseconds. */
|
/* Called every "uiUpdateInterval" mseconds. */
|
||||||
function updateProgressBarValue(){
|
function updateProgressBarValue(){
|
||||||
if (estimatedSchedulePosixTime != -1){
|
if (estimatedSchedulePosixTime != -1){
|
||||||
if (showStartPosixTime != 0){
|
if (showStartPosixTime != 0){
|
||||||
var showPercentDone = (estimatedSchedulePosixTime - showStartPosixTime)/showLengthMs*100;
|
var showPercentDone = (estimatedSchedulePosixTime - showStartPosixTime)/showLengthMs*100;
|
||||||
if (showPercentDone < 0 || showPercentDone > 100){
|
if (showPercentDone < 0 || showPercentDone > 100){
|
||||||
showPercentDone = 0;
|
showPercentDone = 0;
|
||||||
$('#on-air-info').attr("class", "on-air-info off");
|
$('#on-air-info').attr("class", "on-air-info off");
|
||||||
} else {
|
} else {
|
||||||
$('#on-air-info').attr("class", "on-air-info on");
|
$('#on-air-info').attr("class", "on-air-info on");
|
||||||
}
|
}
|
||||||
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
||||||
}
|
}
|
||||||
|
|
||||||
var songPercentDone = 0;
|
var songPercentDone = 0;
|
||||||
if (currentSong.length > 0){
|
if (currentSong.length > 0){
|
||||||
songPercentDone = (estimatedSchedulePosixTime - currentSong[0].songStartPosixTime)/currentSong[0].songLengthMs*100;
|
songPercentDone = (estimatedSchedulePosixTime - currentSong[0].songStartPosixTime)/currentSong[0].songLengthMs*100;
|
||||||
if (songPercentDone < 0 || songPercentDone > 100){
|
if (songPercentDone < 0 || songPercentDone > 100){
|
||||||
songPercentDone = 0;
|
songPercentDone = 0;
|
||||||
currentSong = new Array();
|
currentSong = new Array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('#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
|
||||||
|
@ -200,29 +104,29 @@ function updateProgressBarValue(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlaybar();
|
updatePlaybar();
|
||||||
}
|
}
|
||||||
setTimeout(secondsTimer, uiUpdateInterval);
|
setTimeout(secondsTimer, uiUpdateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlaybar(){
|
function updatePlaybar(){
|
||||||
/* Column 0 update */
|
/* Column 0 update */
|
||||||
$('#previous').text("Prev Song: N/A");
|
$('#previous').text("Prev Song: N/A");
|
||||||
$('#prev-length').text("n/a,");
|
$('#prev-length').text("n/a,");
|
||||||
$('#current').text("Current Song: N/A");
|
$('#current').text("Current Song: N/A");
|
||||||
$('#next').text("Next Song: N/A");
|
$('#next').text("Next Song: N/A");
|
||||||
$('#next-length').empty();
|
$('#next-length').empty();
|
||||||
if (previousSongs.length > 0){
|
if (previousSongs.length > 0){
|
||||||
$('#previous').text(getTrackInfo(previousSongs[previousSongs.length-1]));
|
$('#previous').text(getTrackInfo(previousSongs[previousSongs.length-1]));
|
||||||
$('#prev-length').text(convertToHHMMSSmm(previousSongs[previousSongs.length-1].songLengthMs));
|
$('#prev-length').text(convertToHHMMSSmm(previousSongs[previousSongs.length-1].songLengthMs));
|
||||||
}
|
}
|
||||||
if (currentSong.length > 0){
|
if (currentSong.length > 0){
|
||||||
$('#current').text(getTrackInfo(currentSong[0]));
|
$('#current').text(getTrackInfo(currentSong[0]));
|
||||||
}
|
}
|
||||||
if (nextSongs.length > 0){
|
if (nextSongs.length > 0){
|
||||||
$('#next').text(getTrackInfo(nextSongs[0]));
|
$('#next').text(getTrackInfo(nextSongs[0]));
|
||||||
$('#next-length').text(convertToHHMMSSmm(nextSongs[0].songLengthMs));
|
$('#next-length').text(convertToHHMMSSmm(nextSongs[0].songLengthMs));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#start').empty();
|
$('#start').empty();
|
||||||
$('#end').empty();
|
$('#end').empty();
|
||||||
|
@ -231,39 +135,39 @@ function updatePlaybar(){
|
||||||
$('#song-length').empty();
|
$('#song-length').empty();
|
||||||
$('#showposition').empty();
|
$('#showposition').empty();
|
||||||
$('#showlength').empty();
|
$('#showlength').empty();
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#start').text(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#start').text(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
||||||
$('#end').text(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
|
$('#end').text(currentSong[i].ends.substring(currentSong[i].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[i].songStartPosixTime/1000))*1000;
|
||||||
var songEndRoughly = parseInt(Math.round(currentSong[i].songEndPosixTime/1000))*1000;
|
var songEndRoughly = parseInt(Math.round(currentSong[i].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[i].songLengthMs));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column 1 update */
|
/* Column 1 update */
|
||||||
$('#playlist').text("Current Show: N/A");
|
$('#playlist').text("Current Show: N/A");
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#playlist').text(currentSong[i].name);
|
$('#playlist').text(currentSong[i].name);
|
||||||
}
|
}
|
||||||
$('#show-length').empty();
|
$('#show-length').empty();
|
||||||
if (estimatedSchedulePosixTime < showEndPosixTime){
|
if (estimatedSchedulePosixTime < showEndPosixTime){
|
||||||
$('#show-length').text(convertDateToHHMMSS(showStartPosixTime) + " - " + convertDateToHHMMSS(showEndPosixTime));
|
$('#show-length').text(convertDateToHHMMSS(showStartPosixTime) + " - " + convertDateToHHMMSS(showEndPosixTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column 2 update */
|
/* Column 2 update */
|
||||||
$('#time').text(convertDateToHHMMSS(estimatedSchedulePosixTime));
|
$('#time').text(convertDateToHHMMSS(estimatedSchedulePosixTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcAdditionalData(currentItem, bUpdateGlobalValues){
|
function calcAdditionalData(currentItem, bUpdateGlobalValues){
|
||||||
for (var i=0; i<currentItem.length; i++){
|
for (var i=0; i<currentItem.length; i++){
|
||||||
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].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].showEndPosixTime = convertDateToPosixTime(currentItem[i].starts.substring(0, currentItem[i].starts.indexOf(" ")) + " " + currentItem[i].end_time);
|
||||||
|
@ -279,55 +183,55 @@ function calcAdditionalData(currentItem, bUpdateGlobalValues){
|
||||||
if (bUpdateGlobalValues){
|
if (bUpdateGlobalValues){
|
||||||
updateGlobalValues(currentItem[i]);
|
updateGlobalValues(currentItem[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(obj){
|
function parseItems(obj){
|
||||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||||
|
|
||||||
previousSongs = obj.previous;
|
previousSongs = obj.previous;
|
||||||
currentSong = obj.current;
|
currentSong = obj.current;
|
||||||
nextSongs = obj.next;
|
nextSongs = obj.next;
|
||||||
|
|
||||||
calcAdditionalData(previousSongs, false);
|
calcAdditionalData(previousSongs, false);
|
||||||
calcAdditionalData(currentSong, true);
|
calcAdditionalData(currentSong, true);
|
||||||
calcAdditionalData(nextSongs, false);
|
calcAdditionalData(nextSongs, false);
|
||||||
|
|
||||||
if (estimatedSchedulePosixTime == -1){
|
if (estimatedSchedulePosixTime == -1){
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||||
estimatedSchedulePosixTime = schedulePosixTime;
|
estimatedSchedulePosixTime = schedulePosixTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScheduleFromServer(){
|
function getScheduleFromServer(){
|
||||||
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
|
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
|
||||||
parseItems(data.entries);
|
parseItems(data.entries);
|
||||||
}});
|
}});
|
||||||
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(elemID) {
|
function init(elemID) {
|
||||||
//begin producer "thread"
|
//begin producer "thread"
|
||||||
getScheduleFromServer();
|
getScheduleFromServer();
|
||||||
|
|
||||||
//begin consumer "thread"
|
//begin consumer "thread"
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
function popup(mylink){
|
function popup(mylink){
|
||||||
if (!window.focus)
|
if (!window.focus)
|
||||||
return true;
|
return true;
|
||||||
var href;
|
var href;
|
||||||
if (typeof(mylink) == 'string')
|
if (typeof(mylink) == 'string')
|
||||||
href=mylink;
|
href=mylink;
|
||||||
else
|
else
|
||||||
href=mylink.href;
|
href=mylink.href;
|
||||||
window.open(href, "player", 'width=300,height=100,scrollbars=yes');
|
window.open(href, "player", 'width=300,height=100,scrollbars=yes');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//initialize the playlist bar in the included playlist.js
|
//initialize the playlist bar in the included playlist.js
|
||||||
init("nowplayingbar");
|
init("nowplayingbar");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue