1
0
mirror of https://github.com/moparisthebest/rcrdit synced 2024-12-21 23:08:57 -05: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

@ -458,6 +458,17 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
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;
@ -336,12 +337,18 @@ ul#channelGroups li ul li ul li.channel {
padding: 21px;
margin-left: 10px;
margin-right: 10px;
vertical-align:top;
}
.sectionSelection:hover{
cursor: pointer;
}
.nowRecording{
color: white;
overflow:hidden;
}
.logoImageDiv{
display: inline-block;
float:left;
@ -359,3 +366,9 @@ ul#channelGroups li ul li ul li.channel {
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 ){