2013-11-27 12:04:19 -07:00
|
|
|
|
(function ($, document, apiClient) {
|
|
|
|
|
|
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
|
|
|
|
|
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-01-12 22:41:00 -07:00
|
|
|
|
shape: "backdrop",
|
2013-12-28 16:09:24 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-01-01 11:26:31 -07:00
|
|
|
|
overlayText: true,
|
|
|
|
|
coverImage: true
|
2013-12-28 16:09:24 -07:00
|
|
|
|
|
2014-01-16 20:13:12 -07:00
|
|
|
|
})).createPosterItemHoverMenu();
|
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-01-01 11:26:31 -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
|
|
|
|
|
|
|
|
|
apiClient.getLiveTvRecordings({
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
apiClient.getLiveTvRecordingGroups({
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-11-27 12:04:19 -07:00
|
|
|
|
$(document).on('pagebeforeshow', "#liveTvRecordingsPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
2013-12-28 14:37:01 -07:00
|
|
|
|
|
2013-11-27 12:04:19 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, ApiClient);
|