-currently playing + playlist now available (as a Jquery plugin!). Next step is to improve UI.
This commit is contained in:
parent
ffa508de34
commit
4ac347cb65
3 changed files with 21 additions and 16 deletions
|
@ -452,7 +452,7 @@ class Schedule {
|
|||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable], $CC_CONFIG[filesTable]"
|
||||
." WHERE ($CC_CONFIG[scheduleTable].ends < TIMESTAMP '$timeNow')"
|
||||
." AND ($CC_CONFIG[scheduleTable].file_id = $CC_CONFIG[filesTable].id)"
|
||||
." ORDER BY $CC_CONFIG[scheduleTable].id"
|
||||
." ORDER BY $CC_CONFIG[scheduleTable].starts DESC"
|
||||
." LIMIT $prevCount";
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
|
@ -474,7 +474,7 @@ class Schedule {
|
|||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable], $CC_CONFIG[filesTable]"
|
||||
." WHERE ($CC_CONFIG[scheduleTable].starts > TIMESTAMP '$timeNow')"
|
||||
." AND ($CC_CONFIG[scheduleTable].file_id = $CC_CONFIG[filesTable].id)"
|
||||
." ORDER BY $CC_CONFIG[scheduleTable].id"
|
||||
." ORDER BY $CC_CONFIG[scheduleTable].starts"
|
||||
." LIMIT $nextCount";
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
});
|
||||
</script>
|
||||
<div id="list0"></div>
|
||||
<div id="spaceused1"></div>
|
||||
</div>
|
||||
|
|
|
@ -20,15 +20,23 @@
|
|||
prevDiv.setAttribute("id", "previous");
|
||||
$(cc.currentElem).append(prevDiv);
|
||||
|
||||
var currParentDiv = document.createElement('div');
|
||||
currParentDiv.setAttribute("style", "background-color:#bbbbbb;");
|
||||
$(cc.currentElem).append(currParentDiv);
|
||||
|
||||
var currDiv = document.createElement('div');
|
||||
currDiv.setAttribute("id", "current");
|
||||
$(cc.currentElem).append(currDiv);
|
||||
$(currParentDiv).append(currDiv);
|
||||
|
||||
var nextDiv = document.createElement('div');
|
||||
nextDiv.setAttribute("id", "progressbar");
|
||||
$(currParentDiv).append(nextDiv);
|
||||
|
||||
var nextDiv = document.createElement('div');
|
||||
nextDiv.setAttribute("id", "next");
|
||||
$(cc.currentElem).append(nextDiv);
|
||||
|
||||
$('#spaceused1').progressBar(0);
|
||||
$('#progressbar').progressBar(0);
|
||||
|
||||
getScheduleFromServer();
|
||||
updateProgressBarValue();
|
||||
|
@ -40,13 +48,10 @@
|
|||
var day = s.substring(8, 10);
|
||||
var hour = s.substring(11, 13);
|
||||
var minute = s.substring(14, 16);
|
||||
var sec = 0;
|
||||
var sec = s.substring(17, 19);
|
||||
var msec = 0;
|
||||
if (s.length >= 20){
|
||||
sec = s.substring(17, 19);
|
||||
msec = s.substring(20);
|
||||
} else {
|
||||
sec = s.substring(17);
|
||||
}
|
||||
|
||||
return Date.UTC(year, month, day, hour, minute, sec, msec);
|
||||
|
@ -62,17 +67,21 @@
|
|||
if (cc.currentSong.length > 0){
|
||||
var percentDone = (cc.estimatedSchedulePosixTime - cc.currentSong[0].songStartPosixTime)/cc.currentSong[0].songLengthMs*100;
|
||||
if (percentDone <= 100){
|
||||
$('#spaceused1').progressBar(percentDone);
|
||||
$('#progressbar').progressBar(percentDone);
|
||||
} else {
|
||||
if (nextSongs.length > 0){
|
||||
if (cc.nextSongs.length > 0){
|
||||
cc.currentSong[0] = cc.nextSongs.shift();
|
||||
} else {
|
||||
cc.currentSong = new Array();
|
||||
}
|
||||
$('#spaceused1').progressBar(0);
|
||||
$('#progressbar').progressBar(0);
|
||||
//at the end of each song we are updating the
|
||||
//server time we have been estimating client-side
|
||||
//with the real server time.
|
||||
cc.estimatedSchedulePosixTime = cc.schedulePosixTime;
|
||||
}
|
||||
}
|
||||
} else
|
||||
$('#progressbar').progressBar(0);
|
||||
updatePlaylist();
|
||||
}
|
||||
setTimeout(secondsTimer, 1000);
|
||||
|
@ -93,19 +102,16 @@
|
|||
var divElem = document.createElement('div');
|
||||
divElem.innerHTML = createPlaylistElementString(cc.previousSongs[i]);
|
||||
$('#previous').append(divElem);
|
||||
//cc.currentElem.html(createPlaylistElementString(previousSongs[i]));
|
||||
}
|
||||
for (var i=0; i<cc.currentSong.length; i++){
|
||||
var divElem = document.createElement('div');
|
||||
divElem.innerHTML = createPlaylistElementString(cc.currentSong[i]);
|
||||
$('#current').append(divElem);
|
||||
//cc.currentElem.html(createPlaylistElementString(currentSong[i]));
|
||||
}
|
||||
for (var i=0; i<cc.nextSongs.length; i++){
|
||||
var divElem = document.createElement('div');
|
||||
divElem.innerHTML = createPlaylistElementString(cc.nextSongs[i]);
|
||||
$('#next').append(divElem);
|
||||
//cc.currentElem.html(createPlaylistElementString(nextSongs[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue