Check every 30 seconds/display what is currently recording

This commit is contained in:
Jeff Lamb 2017-03-11 22:37:02 -05:00
parent db70070769
commit 3419226e2a
5 changed files with 55 additions and 3 deletions

View File

@ -451,13 +451,24 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
return new HashMap<>();
}
@POST
@POST
@Path("getAutoRecs")
@Produces(MediaType.APPLICATION_JSON)
public List<AutoRec> getAutoRecs() {
return autoRecs;
}
@POST
@Path("getCurrentlyRecording")
@Produces(MediaType.APPLICATION_JSON)
public List<ProgramAutoRec> getCurrentlyRecording() {
List<ProgramAutoRec> currentlyRecording = new ArrayList<>();
tuners.getTuners().stream().map((tuner) -> tuner.getRecording()).filter((rec) -> (rec != null)).forEach((rec) -> {
currentlyRecording.add(rec);
});
return currentlyRecording;
}
@POST
@Path("getSchedule")
@Produces(MediaType.APPLICATION_JSON)

View File

@ -107,6 +107,12 @@ public class Tuners implements Tuner {
return chosenTuner.recordNow(par, timer);
}
public List<Tuner> getTuners() {
return tuners;
}
@Override
public synchronized boolean stopRecording(final ProgramAutoRec program) {
for (final Tuner tuner : tuners)

View File

@ -256,6 +256,7 @@ ul#channelGroups li ul li ul li.channel {
#rcrditHeader{
width: 70%;
min-width:1100 px;
margin-left: auto;
margin-right: auto;
padding-left: 15px;
@ -335,13 +336,19 @@ ul#channelGroups li ul li ul li.channel {
width:128px;
padding: 21px;
margin-left: 10px;
margin-right: 10px;
margin-right: 10px;
vertical-align:top;
}
.sectionSelection:hover{
cursor: pointer;
}
.nowRecording{
color: white;
overflow:hidden;
}
.logoImageDiv{
display: inline-block;
float:left;
@ -358,4 +365,10 @@ ul#channelGroups li ul li ul li.channel {
padding:20px;
border-radius: 30px;
height: 400px;
}
.circle:before {
content: ' \25CF';
font-size: 15px;
color:red;
}

View File

@ -41,7 +41,7 @@
<div class="sectionSelection" id="gotoAutoRecs"><img alt="Schedule" src="images/autorecsicon.png"/></div>
<div class="sectionSelection"></div>
<div class="sectionSelection"></div>
<div class="sectionSelection nowRecording"></div>
<div class="sectionSelection nowRecording" id="nowRecordingDiv"></div>
</div>
<div id="guideGoesHere" style='width: 90%'>

View File

@ -23,8 +23,29 @@ $( document ).ready(function() {
$("#autoRecsGoHere").show();
$("#programInfo").dialog("close");
});
getCurrentlyRecording();
setInterval(getCurrentlyRecording,30000);
});
function getCurrentlyRecording(){
$.ajax({
url: 'rest/getCurrentlyRecording',
type: 'post',
dataType: 'json',
success: function (data) {
var nowRecordingTable = $("<table></table");
for(var idx in data){
nowRecordingTable.append($("<tr><td><span class='circle'></span></td><td>"+data[idx].program.title+"</td></tr>"));
}
$("#nowRecordingDiv").html(nowRecordingTable);
},
error: function ( jqXHR, textStatus, errorThrown ){
alert(errorThrown);
}
});
}
function getAutoRecs(){
$("#autoRecsGoHere").html("");
@ -473,6 +494,7 @@ function scheduleRecording(recordingDetails){
data: JSON.stringify(recordingDetails),
success: function (data) {
$("#recordOptionsDiv").hide();
setTimeout(getCurrentlyRecording,5000);
toastr["success"]("Recording Scheduled!");
},
error: function ( jqXHR, textStatus, errorThrown ){