1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/livetvrecording.js

108 lines
2.8 KiB
JavaScript
Raw Normal View History

(function ($, document, apiClient) {
2013-12-01 11:09:05 -05:00
var currentItem;
2013-12-01 11:09:05 -05:00
function deleteRecording() {
2013-12-01 11:09:05 -05:00
Dashboard.confirm("Are you sure you wish to delete this recording?", "Confirm Recording Deletion", function (result) {
2013-12-01 11:09:05 -05:00
if (result) {
2013-12-01 11:09:05 -05:00
Dashboard.showLoadingMsg();
2013-12-01 11:09:05 -05:00
ApiClient.deleteLiveTvRecording(currentItem.Id).done(function () {
Dashboard.alert('Recording deleted');
Dashboard.navigate('livetvrecordings.html');
});
}
});
}
function renderRecording(page, item) {
currentItem = item;
2013-12-04 15:55:42 -05:00
var context = 'livetv';
var name = item.Name;
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
Dashboard.setPageTitle(name);
$('.itemName', page).html(name);
$('.itemChannelNumber', page).html(item.Number);
2013-12-04 15:55:42 -05:00
if (item.CommunityRating) {
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
} else {
$('.itemCommunityRating', page).hide();
}
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
2013-12-04 15:55:42 -05:00
LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
LibraryBrowser.renderOverview($('.itemOverview', page), item);
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
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-01 11:09:05 -05:00
}
Dashboard.getCurrentUser().done(function (user) {
if (user.Configuration.IsAdministrator && item.LocationType !== "Offline") {
$('#deleteButtonContainer', page).show();
} else {
$('#deleteButtonContainer', page).hide();
}
});
Dashboard.hideLoadingMsg();
}
function reload(page) {
Dashboard.showLoadingMsg();
var id = getParameterByName('id');
apiClient.getLiveTvRecording(id).done(function (result) {
renderRecording(page, result);
});
}
$(document).on('pageinit', "#liveTvRecordingPage", function () {
var page = this;
$('#btnDelete', page).on('click', deleteRecording);
}).on('pagebeforeshow', "#liveTvRecordingPage", function () {
var page = this;
reload(page);
}).on('pagehide', "#liveTvRecordingPage", function () {
currentItem = null;
2013-12-01 11:09:05 -05:00
});
})(jQuery, document, ApiClient);