2013-12-03 21:18:50 -07:00
|
|
|
|
(function ($, document, apiClient) {
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
var currentItem;
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
function deleteRecording() {
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
Dashboard.confirm("Are you sure you wish to delete this recording?", "Confirm Recording Deletion", function (result) {
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
if (result) {
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
ApiClient.deleteLiveTvRecording(currentItem.Id).done(function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.alert('Recording deleted');
|
|
|
|
|
|
|
|
|
|
Dashboard.navigate('livetvrecordings.html');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-12-21 11:37:34 -07:00
|
|
|
|
|
|
|
|
|
function play() {
|
|
|
|
|
|
|
|
|
|
var userdata = currentItem.UserData || {};
|
|
|
|
|
|
|
|
|
|
var mediaType = currentItem.MediaType;
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, mediaType, userdata.PlaybackPositionTicks);
|
|
|
|
|
}
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
|
|
|
|
function renderRecording(page, item) {
|
|
|
|
|
|
|
|
|
|
currentItem = item;
|
2013-12-04 13:55:42 -07:00
|
|
|
|
var context = 'livetv';
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
|
|
|
|
var name = item.Name;
|
|
|
|
|
|
|
|
|
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
|
|
|
|
|
|
|
|
|
Dashboard.setPageTitle(name);
|
|
|
|
|
|
|
|
|
|
$('.itemName', page).html(name);
|
2013-12-12 21:06:38 -07:00
|
|
|
|
|
2013-12-21 11:37:34 -07:00
|
|
|
|
$('.itemEpisodeName', page).html(item.EpisodeTitle || '');
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
2013-12-04 13:55:42 -07:00
|
|
|
|
if (item.CommunityRating) {
|
|
|
|
|
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.itemCommunityRating', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
|
|
|
|
|
|
2013-12-04 13:55:42 -07:00
|
|
|
|
LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
|
|
|
|
|
LibraryBrowser.renderOverview($('.itemOverview', page), item);
|
2013-12-03 21:18:50 -07:00
|
|
|
|
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
|
|
|
|
|
2013-12-21 11:37:34 -07:00
|
|
|
|
LiveTvHelpers.renderMiscProgramInfo($('.miscTvProgramInfo', page), item);
|
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
if (ApiClient.isWebSocketOpen()) {
|
|
|
|
|
|
|
|
|
|
var vals = [item.Type, item.Id, item.Name];
|
|
|
|
|
|
|
|
|
|
vals.push('livetv');
|
|
|
|
|
|
|
|
|
|
ApiClient.sendWebSocketMessage("Context", vals.join('|'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MediaPlayer.canPlay(item)) {
|
|
|
|
|
$('#playButtonContainer', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#playButtonContainer', page).hide();
|
2013-12-12 21:06:38 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.status', page).html('Status: ' + item.Status);
|
2013-12-01 09:09:05 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
|
|
|
|
|
if (user.Configuration.IsAdministrator && item.LocationType !== "Offline") {
|
|
|
|
|
$('#deleteButtonContainer', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#deleteButtonContainer', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2013-12-21 11:37:34 -07:00
|
|
|
|
LiveTvHelpers.renderOriginalAirDate($('.airDate', page), item);
|
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
2013-12-17 13:02:12 -07:00
|
|
|
|
apiClient.getLiveTvRecording(id, Dashboard.getCurrentUserId()).done(function (result) {
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
|
|
|
|
renderRecording(page, result);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageinit', "#liveTvRecordingPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#btnDelete', page).on('click', deleteRecording);
|
2013-12-21 11:37:34 -07:00
|
|
|
|
$('#btnPlay', page).on('click', play);
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
|
|
|
|
}).on('pagebeforeshow', "#liveTvRecordingPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
|
|
|
|
|
}).on('pagehide', "#liveTvRecordingPage", function () {
|
|
|
|
|
|
|
|
|
|
currentItem = null;
|
2013-12-01 09:09:05 -07:00
|
|
|
|
});
|
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
})(jQuery, document, ApiClient);
|