## Last Ten Recordings

<% var oDvr = new Dvr(); var list = oDvr.GetRecordedList( true, 0, 10 ); for (var nIdx=0; nIdx < list.Programs.length; nIdx++) { var program = list.Programs[ nIdx ]; var title = ''; if (program.SubTitle == '') title = program.Title; else if (program.Episode > 0) title = program.Title + " " + program.Season + "x" + pad(program.Episode) + " (" + program.SubTitle + ")"; else title = program.Title + " (" + program.SubTitle + ")"; var month_names = new Array(); month_names[month_names.length] = "January"; month_names[month_names.length] = "February"; month_names[month_names.length] = "March"; month_names[month_names.length] = "April"; month_names[month_names.length] = "May"; month_names[month_names.length] = "June"; month_names[month_names.length] = "July"; month_names[month_names.length] = "August"; month_names[month_names.length] = "September"; month_names[month_names.length] = "October"; month_names[month_names.length] = "November"; month_names[month_names.length] = "December"; var day_names = new Array(); day_names[day_names.length] = "Sunday"; day_names[day_names.length] = "Monday"; day_names[day_names.length] = "Tuesday"; day_names[day_names.length] = "Wednesday"; day_names[day_names.length] = "Thursday"; day_names[day_names.length] = "Friday"; day_names[day_names.length] = "Saturday"; function pad(n) { return n<10 ? '0'+n : n } var startTime = program.StartTime.getHours() + ":" + pad(program.StartTime.getMinutes()); var desc = formatStr('%1
Recorded %2, %3 %4 at %5.', program.Description, day_names[program.StartTime.getDay()], month_names[program.StartTime.getMonth()], program.StartTime.getDate(), startTime); %> <% } %>

## Current Tuner Activity

<% var oDvr = new Dvr(); var encoderlist = oDvr.GetEncoderList(); for (var nIdx=0; nIdx < encoderlist.Encoders.length; nIdx++) { var encoder = encoderlist.Encoders[ nIdx ]; var statestring = ''; var state = encoder.State; switch(state) { case 1: var recording = encoder.Recording; statestring = formatStr('Encoder %1 is currently watching "%2" on Live TV.', encoder.Id, recording.Title); break; case 6: var recording = encoder.Recording; statestring = formatStr('Encoder %1 is currently recording "%2." This program is being viewed.', encoder.Id, recording.Title); break; case 7: var recording = encoder.Recording; var endtime = recording.EndTime.getHours() + ':' + pad(recording.EndTime.getMinutes()); statestring = formatStr('Encoder %1 is currently recording "%2." This recording will end at %3.', encoder.Id, recording.Title, endtime); break; default: statestring = formatStr('Encoder %1 is currently idle.', encoder.Id); break; } os.writeln("
- " + statestring + "
"); } %>

<% function ISODateString(d) { function pad(n) { return n<10 ? '0'+n : n } return d.getFullYear()+'-' + pad(d.getMonth()+1)+'-' + pad(d.getDate())+'T' + pad(d.getHours())+':' + pad(d.getMinutes())+':' + pad(d.getSeconds())+'Z' } %> <% function UTCDateString(d) { function pad(n) { return n<10 ? '0'+n : n } return d.getUTCFullYear()+'-' + pad(d.getUTCMonth()+1)+'-' + pad(d.getUTCDate())+'T' + pad(d.getUTCHours())+':' + pad(d.getUTCMinutes())+':' + pad(d.getUTCSeconds())+'Z' } %>