Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
c4053a1b38
6 changed files with 169 additions and 114 deletions
|
@ -1,110 +0,0 @@
|
|||
<div>
|
||||
<script>
|
||||
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 = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
var schedulePosixTime;
|
||||
|
||||
var previousSong;
|
||||
var currentSong;
|
||||
var nextSong;
|
||||
|
||||
var updatedSchedule = false;
|
||||
|
||||
function secondsTimer(){
|
||||
schedulePosixTime += 1000;
|
||||
updateProgressBarValue();
|
||||
}
|
||||
|
||||
function updateProgressBarValue(){
|
||||
var percentDone = (schedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||
if (percentDone <= 100){
|
||||
$('#spaceused1').progressBar(percentDone);
|
||||
setTimeout(secondsTimer, 1000);
|
||||
|
||||
if (!updatedSchedule && (currentSong.songEndPosixTime - schedulePosixTime < 5000)){
|
||||
updatedSchedule = true;
|
||||
getScheduleFromServer();
|
||||
}
|
||||
} else {
|
||||
currentSong = nextSong;
|
||||
updatedSchedule = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentPlayingItem(currentItem){
|
||||
var songStartPosixTime = convertDateToPosixTime(currentItem.starts);
|
||||
var songEndPosixTime = convertDateToPosixTime(currentItem.ends);
|
||||
|
||||
return {songLengthMs:songEndPosixTime-songStartPosixTime, songStartPosixTime:songStartPosixTime, songEndPosixTime:songEndPosixTime};
|
||||
|
||||
}
|
||||
|
||||
function prepareNextPlayingItem(obj){
|
||||
if (obj.next.length > 0){
|
||||
var nextItem = obj.next[0];
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(obj){
|
||||
schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||
if (obj.previous.length > 0){
|
||||
previousSong = getCurrentPlayingItem(obj.previous[0]);
|
||||
$("#previous").html(obj.schedulerTime + " " + schedulePosixTime + "<br>" +
|
||||
obj.previous[0].clip_length + " " + previousSong.songLengthMs + "<br>" +
|
||||
obj.previous[0].starts + " " + previousSong.songStartPosixTime + "<br>" +
|
||||
obj.previous[0].ends + " " + previousSong.songEndPosixTime + "<br>" +
|
||||
obj.previous[0].name + "<br>");
|
||||
}
|
||||
if (obj.current.length > 0){
|
||||
currentSong = getCurrentPlayingItem(obj.current[0]);
|
||||
$("#current").html(obj.schedulerTime + " " + schedulePosixTime + "<br>" +
|
||||
obj.current[0].clip_length + " " + currentSong.songLengthMs + "<br>" +
|
||||
obj.current[0].starts + " " + currentSong.songStartPosixTime + "<br>" +
|
||||
obj.current[0].ends + " " + currentSong.songEndPosixTime + "<br>" +
|
||||
obj.current[0].name + "<br>");
|
||||
}
|
||||
if (obj.next.length > 0){
|
||||
nextSong = getCurrentPlayingItem(obj.next[0]);
|
||||
$("#next").html(obj.schedulerTime + " " + schedulePosixTime + "<br>" +
|
||||
obj.next[0].clip_length + " " + nextSong.songLengthMs + "<br>" +
|
||||
obj.next[0].starts + " " + nextSong.songStartPosixTime + "<br>" +
|
||||
obj.next[0].ends + " " + nextSong.songEndPosixTime + "<br>" +
|
||||
obj.next[0].name + "<br>");
|
||||
}
|
||||
updateProgressBarValue();
|
||||
}
|
||||
|
||||
function getScheduleFromServer(){
|
||||
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
|
||||
//alert(data);
|
||||
parseItems(data.entries);
|
||||
}});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#spaceused1").progressBar();
|
||||
getScheduleFromServer();
|
||||
});
|
||||
</script>
|
||||
<div id="previous" style="background: blue;"></div>
|
||||
<div id="current" style="background: white;"></div>
|
||||
<span class="progressBar" id="spaceused1">0%</span>
|
||||
<div id="next" style="background: yellow;"></div>
|
||||
|
||||
</div>
|
9
application/views/scripts/schedule/view-playlist.phtml
Normal file
9
application/views/scripts/schedule/view-playlist.phtml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#list0").playlistViewer();
|
||||
});
|
||||
</script>
|
||||
<div id="list0"></div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue