1
0
mirror of https://github.com/moparisthebest/rcrdit synced 2024-12-21 23:08:57 -05:00

Very basic listing of upcoming recordings functionality in the UI

This commit is contained in:
Jeff Lamb 2017-03-12 23:44:45 -04:00
parent ce4481f60c
commit c9de3a4e2c
4 changed files with 67 additions and 13 deletions

View File

@ -323,6 +323,7 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
cursor = cursor.plus(1, ChronoUnit.MINUTES);
}
// increment by minute up until end scheduling all timers until then, somehow store this info to show/email etc?
log.debug("import done.\n\n------\n\n");
if (!calendar.getComponents().isEmpty())
try (FileOutputStream fout = new FileOutputStream("rcrdit.ics")) {
@ -331,6 +332,7 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
} catch (Exception e) {
// ignore e.printStackTrace();
}
}
private static void removeStoppedShows(final VTimeZone tz, final Calendar calendar, final Map<ProgramAutoRec, Instant> recs, final Instant finalCursor, final MessageDigest md, final boolean skipped) {
@ -449,7 +451,6 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
@POST
@Path("getRecordingProfiles")
@Produces(MediaType.APPLICATION_JSON)
//List<Channel>
public Map<Integer, Profile> getRecordingProfiles() {
try (Connection conn = DriverManager.getConnection(databaseUrl);
QueryMapper qm = new QueryMapper(conn)) {
@ -479,11 +480,27 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
return currentlyRecording;
}
@POST
@Path("getUpcomingRecordings")
@Produces(MediaType.APPLICATION_JSON)
public Map<Long,Program> getUpcomingRecordings() {
Map<Long,Program> returnMap = new LinkedHashMap<>();
for(TimerTask t : startTimers){
if(t instanceof RecordingTask){
RecordingTask rt = (RecordingTask)t;
if(rt.start != null && rt.scheduledExecutionTime() > System.currentTimeMillis()){
returnMap.put(rt.scheduledExecutionTime(),rt.start.getProgram());
}
}
}
return returnMap;
}
@POST
@Path("getSchedule")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
//List<Channel>
public GetScheduleResponse getSchedule(GetScheduleRequest scheduleRequest) {
List<Channel> channelList = new ArrayList<>();
try{
@ -506,7 +523,6 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
@POST
@Path("recordSingleInstanceOfProgram")
@Consumes(MediaType.APPLICATION_JSON)
//List<Channel>
public String recordSingleInstanceOfProgram(NewRecordingRequest recordingRequest) {
try (Connection conn = DriverManager.getConnection(databaseUrl);
@ -532,19 +548,10 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
@POST
@Path("refreshAutoRecs")
//List<Channel>
public void refreshAutoRecs() {
timer.schedule(new AutoRecTask(), 0);
}
/* @GET
@Path("getSchedule")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public void getSchedule() {
return schedule;
}*/
public static void main(String[] args) throws Exception {
final File cfg;
if (args.length < 1 || !((cfg = new File(args[0])).exists())) {

View File

@ -337,6 +337,7 @@ ul#channelGroups li ul li ul li.channel {
padding: 21px;
margin-left: 10px;
margin-right: 10px;
color:white;
vertical-align:top;
}
@ -367,6 +368,14 @@ ul#channelGroups li ul li ul li.channel {
height: 400px;
}
#upcomingRecordingsGoHere{
margin-left: auto;
margin-right: auto;
background-color: white;
padding:20px;
border-radius: 30px;
}
.circle:before {
content: ' \25CF';
font-size: 15px;

View File

@ -39,7 +39,7 @@
<div class="logoImageDiv"><a href="javascript:forceScheduleUpdate();"><img src="images/rcrditx128.png" alt='logo'/></a></div>
<div class="sectionSelection" id="gotoTvGuide"><img alt="Schedule" src="images/guideicon.png"/></div>
<div class="sectionSelection" id="gotoAutoRecs"><img alt="Schedule" src="images/autorecsicon.png"/></div>
<div class="sectionSelection"></div>
<div class="sectionSelection" id="gotoUpcomingRecordings">Upcoming Recordings</div>
<div class="sectionSelection"></div>
<div class="sectionSelection nowRecording" id="nowRecordingDiv"></div>
</div>
@ -50,5 +50,6 @@
</div>
<div id="autoRecsGoHere" style='display:none; width: 90%'></div>
<div id="upcomingRecordingsGoHere" style='display:none; width: 90%'></div>
</body>
</html>

View File

@ -14,15 +14,26 @@ $( document ).ready(function() {
$("#gotoTvGuide").click(function(){
getSchedule2(null);
$("#autoRecsGoHere").hide();
$("#upcomingRecordingsGoHere").hide();
$("#guideGoesHere").show();
});
$("#gotoAutoRecs").click(function(){
$("#guideGoesHere").hide();
$("#upcomingRecordingsGoHere").hide();
getAutoRecs();
$("#autoRecsGoHere").show();
$("#programInfo").dialog("close");
});
$("#gotoUpcomingRecordings").click(function(){
$("#guideGoesHere").hide();
getUpcomingRecordings();
$("#autoRecsGoHere").hide();
$("#upcomingRecordingsGoHere").show();
$("#programInfo").dialog("close");
});
getCurrentlyRecording();
setInterval(getCurrentlyRecording,30000);
});
@ -46,6 +57,32 @@ function getCurrentlyRecording(){
});
}
function getUpcomingRecordings(){
$("#upcomingRecordingsGoHere").html("");
$.ajax({
url: 'rest/getUpcomingRecordings',
type: 'post',
dataType: 'json',
success: function (data) {
var upcomingRecordingsDiv = $("#upcomingRecordingsGoHere");
var upcomingRecordingTable = $("<table></table");
for(var idx in data){
var scheduledRec = data[idx];
var startRecordingDate = new Date(0);
startRecordingDate.setUTCSeconds((idx/1000));
var subtitle = scheduledRec.subTitle;
if(subtitle === null)subtitle = "";
upcomingRecordingTable.append($("<tr></tr>").append($("<td></td>").append(startRecordingDate.toString()+" - "+scheduledRec.title+" - "+subtitle)));
}
upcomingRecordingsDiv.append(upcomingRecordingTable);
},
error: function ( jqXHR, textStatus, errorThrown ){
alert(errorThrown);
}
});
}
function getAutoRecs(){
$("#autoRecsGoHere").html("");