-basic now playing bar
This commit is contained in:
parent
616b85ddef
commit
8d5aea0d14
4 changed files with 54 additions and 49 deletions
|
@ -276,28 +276,3 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -479,10 +479,10 @@ class Schedule {
|
||||||
|
|
||||||
private static function GetPreviousItems($timeNow, $prevCount = 1){
|
private static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable], $CC_CONFIG[filesTable]"
|
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||||
." WHERE ($CC_CONFIG[scheduleTable].ends < TIMESTAMP '$timeNow')"
|
." WHERE (st.ends < TIMESTAMP '$timeNow')"
|
||||||
." AND ($CC_CONFIG[scheduleTable].file_id = $CC_CONFIG[filesTable].id)"
|
." AND (st.file_id = ft.id)"
|
||||||
." ORDER BY $CC_CONFIG[scheduleTable].starts DESC"
|
." ORDER BY st.starts DESC"
|
||||||
." LIMIT $prevCount";
|
." LIMIT $prevCount";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
return $rows;
|
return $rows;
|
||||||
|
@ -491,20 +491,21 @@ class Schedule {
|
||||||
private static function GetCurrentlyPlaying($timeNow){
|
private static function GetCurrentlyPlaying($timeNow){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable], $CC_CONFIG[filesTable]"
|
$sql = "SELECT *, pt.name as playlistName FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt"
|
||||||
." WHERE ($CC_CONFIG[scheduleTable].starts < TIMESTAMP '$timeNow')"
|
." WHERE (st.starts < TIMESTAMP '$timeNow')"
|
||||||
." AND ($CC_CONFIG[scheduleTable].ends > TIMESTAMP '$timeNow')"
|
." AND (st.ends > TIMESTAMP '$timeNow')"
|
||||||
." AND ($CC_CONFIG[scheduleTable].file_id = $CC_CONFIG[filesTable].id)";
|
." AND (st.playlist_id = pt.id)"
|
||||||
|
." AND (st.file_id = ft.id)";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function GetNextItems($timeNow, $nextCount = 1) {
|
private static function GetNextItems($timeNow, $nextCount = 1) {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable], $CC_CONFIG[filesTable]"
|
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||||
." WHERE ($CC_CONFIG[scheduleTable].starts > TIMESTAMP '$timeNow')"
|
." WHERE (st.starts > TIMESTAMP '$timeNow')"
|
||||||
." AND ($CC_CONFIG[scheduleTable].file_id = $CC_CONFIG[filesTable].id)"
|
." AND (st.file_id = ft.id)"
|
||||||
." ORDER BY $CC_CONFIG[scheduleTable].starts"
|
." ORDER BY st.starts"
|
||||||
." LIMIT $nextCount";
|
." LIMIT $nextCount";
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
return $rows;
|
return $rows;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div>Volume</div>
|
<div>Volume</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='col1' style='float:left; width: 30%; height: 100%;'>
|
<div id='col1' style='float:left; width: 25%; height: 100%;'>
|
||||||
<div>Show: <span id='show'></span></div>
|
<div>Show: <span id='show'></span></div>
|
||||||
<div>Playlist: <span id='playlist'></span></div>
|
<div>Playlist: <span id='playlist'></span></div>
|
||||||
<div>Host: <span id='host'></span></div>
|
<div>Host: <span id='host'></span></div>
|
||||||
|
@ -15,7 +15,8 @@
|
||||||
<div>Upcoming: <span id='next'></span></div>
|
<div>Upcoming: <span id='next'></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='list0' style='float:left; width: 30%; height: 100%;'></div>
|
<div id='list0' style='float:left; width: 35%; height: 100%;'></div>
|
||||||
<div>Start: <span id='start'></span> End: <span id='end'></span></div>
|
<div>Start: <span id='start'></span></div>
|
||||||
<div id='progressbar'></div>
|
<div>End: <span id='end'></span></div>
|
||||||
|
<div><span id='progressbar'></span> <span id='songposition'></span> | <span id='songlength'></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,9 +8,9 @@ var nextSongs;
|
||||||
var currentElem;
|
var currentElem;
|
||||||
|
|
||||||
function init(elemID) {
|
function init(elemID) {
|
||||||
var currentElem = $("#" + elemID).attr("style", "z-index: 1; width: 100%; left: 0px; right: 0px; bottom: 0px; color: white; min-height: 100px; background-color: #cc3300;");
|
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);
|
$('#progressbar').progressBar(0, {showText : false});
|
||||||
|
|
||||||
getScheduleFromServer();
|
getScheduleFromServer();
|
||||||
updateProgressBarValue();
|
updateProgressBarValue();
|
||||||
|
@ -67,6 +67,30 @@ function getTrackInfo(song){
|
||||||
return song.track_title + " - " + song.artist_name + " - " + song.album_title;
|
return song.track_title + " - " + song.artist_name + " - " + song.album_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
minutes = "" + minutes;
|
||||||
|
seconds = "" + seconds;
|
||||||
|
|
||||||
|
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 updatePlaylist(){
|
function updatePlaylist(){
|
||||||
/* Column 0 update */
|
/* Column 0 update */
|
||||||
$('#listen');
|
$('#listen');
|
||||||
|
@ -78,8 +102,8 @@ function updatePlaylist(){
|
||||||
$('#host').empty();
|
$('#host').empty();
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#show').append(currentSong[i].show);
|
$('#show').append(currentSong[i].show);
|
||||||
$('#playlist').append(currentSong[i].playlist);
|
$('#playlist').append(currentSong[i].playlistname);
|
||||||
$('#host').append(currentSong[i].host);
|
$('#host').append(currentSong[i].creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column 2 update */
|
/* Column 2 update */
|
||||||
|
@ -90,7 +114,7 @@ function updatePlaylist(){
|
||||||
$('#previous').append(getTrackInfo(previousSongs[i]));
|
$('#previous').append(getTrackInfo(previousSongs[i]));
|
||||||
}
|
}
|
||||||
for (var i=0; i<currentSong.length; i++){
|
for (var i=0; i<currentSong.length; i++){
|
||||||
$('#current').append(getTrackInfo(currentSongs[i]));
|
$('#current').append(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').append(getTrackInfo(nextSongs[i]));
|
||||||
|
@ -99,9 +123,13 @@ function updatePlaylist(){
|
||||||
/* Column 3 update */
|
/* Column 3 update */
|
||||||
$('#start').empty();
|
$('#start').empty();
|
||||||
$('#end').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);
|
$('#start').append(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
|
||||||
$('#end').append(currentSong[i].ends);
|
$('#end').append(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
|
||||||
|
$('#songposition').append(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].songStartPosixTime));
|
||||||
|
$('#songlength').append(currentSong[i].clip_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue