2014-10-15 20:26:39 -07:00
|
|
|
|
(function ($, document) {
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2013-12-28 14:37:01 -07:00
|
|
|
|
function getRecordingGroupHtml(group) {
|
2013-11-29 09:58:24 -07:00
|
|
|
|
|
2013-11-27 12:04:19 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '<li><a href="livetvrecordinglist.html?groupid=' + group.Id + '">';
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '<h3>';
|
|
|
|
|
html += group.Name;
|
|
|
|
|
html += '</h3>';
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '<span class="ui-li-count">' + group.RecordingCount + '</span>';
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '</li>';
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2013-12-28 14:37:01 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2013-11-30 23:25:19 -07:00
|
|
|
|
|
2013-12-28 14:37:01 -07:00
|
|
|
|
function renderRecordingGroups(page, groups) {
|
|
|
|
|
|
2013-12-28 16:09:24 -07:00
|
|
|
|
if (groups.length) {
|
|
|
|
|
$('#recordingGroups', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#recordingGroups', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-28 14:37:01 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '<ul data-role="listview" data-inset="true">';
|
|
|
|
|
|
2013-12-28 14:37:01 -07:00
|
|
|
|
for (var i = 0, length = groups.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
html += getRecordingGroupHtml(groups[i]);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '</ul>';
|
2013-12-28 14:37:01 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
$('#recordingGroupItems', page).html(html).trigger('create');
|
2013-12-28 14:37:01 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
function renderRecordings(elem, recordings) {
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-05-09 12:43:06 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
2013-12-28 16:09:24 -07:00
|
|
|
|
if (recordings.length) {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
elem.show();
|
2013-12-28 16:09:24 -07:00
|
|
|
|
} else {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
elem.hide();
|
2013-12-28 16:09:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
$('.recordingItems', elem).html(LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
|
2013-12-28 16:09:24 -07:00
|
|
|
|
items: recordings,
|
2014-05-29 07:19:12 -07:00
|
|
|
|
shape: "auto",
|
2013-12-28 16:09:24 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-05-09 12:43:06 -07:00
|
|
|
|
overlayText: screenWidth >= 600,
|
2015-04-11 18:38:38 -07:00
|
|
|
|
coverImage: true,
|
|
|
|
|
lazy: true
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
2015-04-11 18:38:38 -07:00
|
|
|
|
})).lazyChildren();
|
2013-12-28 16:09:24 -07:00
|
|
|
|
}
|
2013-11-29 09:58:24 -07:00
|
|
|
|
|
2013-11-27 12:04:19 -07:00
|
|
|
|
function reload(page) {
|
|
|
|
|
|
2013-11-29 09:58:24 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2014-10-15 20:26:39 -07:00
|
|
|
|
ApiClient.getLiveTvRecordings({
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
2014-01-15 08:18:31 -07:00
|
|
|
|
IsInProgress: true
|
2013-12-28 14:37:01 -07:00
|
|
|
|
|
|
|
|
|
}).done(function (result) {
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
renderRecordings($('#activeRecordings', page), result.Items);
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
2014-10-15 20:26:39 -07:00
|
|
|
|
ApiClient.getLiveTvRecordings({
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
2014-01-12 22:41:00 -07:00
|
|
|
|
limit: 12,
|
2014-01-15 08:18:31 -07:00
|
|
|
|
IsInProgress: false
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
}).done(function (result) {
|
|
|
|
|
|
|
|
|
|
renderRecordings($('#latestRecordings', page), result.Items);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-15 20:26:39 -07:00
|
|
|
|
ApiClient.getLiveTvRecordingGroups({
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
userId: Dashboard.getCurrentUserId()
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
|
|
|
|
}).done(function (result) {
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
renderRecordingGroups(page, result.Items);
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-11-27 12:04:19 -07:00
|
|
|
|
}
|
2013-11-29 09:58:24 -07:00
|
|
|
|
|
2015-06-18 21:23:55 -07:00
|
|
|
|
$(document).on('pagebeforeshowready', "#liveTvRecordingsPage", function () {
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
2013-12-28 14:37:01 -07:00
|
|
|
|
|
2013-11-27 12:04:19 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-10-15 20:26:39 -07:00
|
|
|
|
})(jQuery, document);
|