1
0
mirror of https://github.com/moparisthebest/rcrdit synced 2024-10-31 15:25:12 -04:00

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<>(); return new HashMap<>();
} }
@POST @POST
@Path("getAutoRecs") @Path("getAutoRecs")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public List<AutoRec> getAutoRecs() { public List<AutoRec> getAutoRecs() {
return autoRecs; 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 @POST
@Path("getSchedule") @Path("getSchedule")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)

View File

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

View File

@ -256,6 +256,7 @@ ul#channelGroups li ul li ul li.channel {
#rcrditHeader{ #rcrditHeader{
width: 70%; width: 70%;
min-width:1100 px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
padding-left: 15px; padding-left: 15px;
@ -335,13 +336,19 @@ ul#channelGroups li ul li ul li.channel {
width:128px; width:128px;
padding: 21px; padding: 21px;
margin-left: 10px; margin-left: 10px;
margin-right: 10px; margin-right: 10px;
vertical-align:top;
} }
.sectionSelection:hover{ .sectionSelection:hover{
cursor: pointer; cursor: pointer;
} }
.nowRecording{
color: white;
overflow:hidden;
}
.logoImageDiv{ .logoImageDiv{
display: inline-block; display: inline-block;
float:left; float:left;
@ -358,4 +365,10 @@ ul#channelGroups li ul li ul li.channel {
padding:20px; padding:20px;
border-radius: 30px; border-radius: 30px;
height: 400px; 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" id="gotoAutoRecs"><img alt="Schedule" src="images/autorecsicon.png"/></div>
<div class="sectionSelection"></div> <div class="sectionSelection"></div>
<div class="sectionSelection"></div> <div class="sectionSelection"></div>
<div class="sectionSelection nowRecording"></div> <div class="sectionSelection nowRecording" id="nowRecordingDiv"></div>
</div> </div>
<div id="guideGoesHere" style='width: 90%'> <div id="guideGoesHere" style='width: 90%'>

View File

@ -23,8 +23,29 @@ $( document ).ready(function() {
$("#autoRecsGoHere").show(); $("#autoRecsGoHere").show();
$("#programInfo").dialog("close"); $("#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(){ function getAutoRecs(){
$("#autoRecsGoHere").html(""); $("#autoRecsGoHere").html("");
@ -473,6 +494,7 @@ function scheduleRecording(recordingDetails){
data: JSON.stringify(recordingDetails), data: JSON.stringify(recordingDetails),
success: function (data) { success: function (data) {
$("#recordOptionsDiv").hide(); $("#recordOptionsDiv").hide();
setTimeout(getCurrentlyRecording,5000);
toastr["success"]("Recording Scheduled!"); toastr["success"]("Recording Scheduled!");
}, },
error: function ( jqXHR, textStatus, errorThrown ){ error: function ( jqXHR, textStatus, errorThrown ){