mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add more methods to file system interface
This commit is contained in:
parent
2861ff68c9
commit
7743b36bc9
46 changed files with 421 additions and 504 deletions
|
@ -1,52 +1,18 @@
|
|||
(function ($, document, apiClient) {
|
||||
|
||||
function deleteRecording(page, id) {
|
||||
|
||||
Dashboard.confirm("Are you sure you wish to delete this recording?", "Confirm Recording Deletion", function (result) {
|
||||
|
||||
if (result) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.deleteLiveTvRecording(id).done(function () {
|
||||
|
||||
Dashboard.alert('Recording deleted');
|
||||
|
||||
reload(page);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadRecordings(page, elem, groupId) {
|
||||
|
||||
var contentElem = $('.recordingList', elem).html('<div class="circle"></div><div class="circle1"></div>');
|
||||
|
||||
apiClient.getLiveTvRecordings({
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
groupId: groupId
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
renderRecordings(page, contentElem, result.Items);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function getRecordingGroupHtml(group) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div data-role="collapsible" class="recordingGroupCollapsible" data-recordinggroupid="' + group.Id + '" style="margin-top:1em" data-mini="true" data-content-theme="false">';
|
||||
html += '<li><a href="livetvrecordinglist.html?groupid=' + group.Id + '">';
|
||||
|
||||
html += '<h3>' + group.Name + '</h3>';
|
||||
html += '<h3>';
|
||||
html += group.Name;
|
||||
html += '</h3>';
|
||||
|
||||
html += '<div class="recordingList">';
|
||||
html += '</div>';
|
||||
html += '<span class="ui-li-count">' + group.RecordingCount + '</span>';
|
||||
|
||||
html += '</div>';
|
||||
html += '</li>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
@ -61,100 +27,36 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true">';
|
||||
|
||||
for (var i = 0, length = groups.length; i < length; i++) {
|
||||
|
||||
html += getRecordingGroupHtml(groups[i]);
|
||||
}
|
||||
|
||||
var elem = $('#recordingGroupItems', page).html(html).trigger('create');
|
||||
|
||||
$('.recordingGroupCollapsible', elem).on('collapsibleexpand.lazyload', function () {
|
||||
|
||||
$(this).off('collapsibleexpand.lazyload');
|
||||
|
||||
var groupId = this.getAttribute('data-recordinggroupid');
|
||||
|
||||
loadRecordings(page, this, groupId);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function renderRecordings(page, elem, recordings) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-split-icon="delete" data-inset="true">';
|
||||
|
||||
for (var i = 0, length = recordings.length; i < length; i++) {
|
||||
|
||||
var recording = recordings[i];
|
||||
|
||||
html += '<li><a href="livetvrecording.html?id=' + recording.Id + '">';
|
||||
|
||||
html += '<h3>';
|
||||
html += recording.EpisodeTitle || recording.Name;
|
||||
html += '</h3>';
|
||||
|
||||
var startDate = recording.StartDate;
|
||||
|
||||
try {
|
||||
|
||||
startDate = parseISO8601Date(startDate, { toLocal: true });
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
|
||||
var minutes = recording.RunTimeTicks / 600000000;
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
html += '<p>';
|
||||
html += startDate.toLocaleDateString();
|
||||
html += ' • ' + Math.round(minutes) + 'min';
|
||||
html += '</p>';
|
||||
|
||||
if (recording.Status !== 'Completed') {
|
||||
html += '<p class="ui-li-aside"><span style="color:red;">' + recording.StatusName + '</span></p>';
|
||||
}
|
||||
|
||||
html += '</a>';
|
||||
|
||||
html += '<a href="#" class="btnDeleteRecording" data-recordingid="' + recording.Id + '">Delete</a>';
|
||||
|
||||
html += '</li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
|
||||
$('.btnDeleteRecording', elem).on('click', function () {
|
||||
|
||||
var recordingId = this.getAttribute('data-recordingid');
|
||||
|
||||
deleteRecording(page, recordingId);
|
||||
});
|
||||
$('#recordingGroupItems', page).html(html).trigger('create');
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function renderLatestRecordings(page, recordings) {
|
||||
|
||||
|
||||
function renderRecordings(elem, recordings) {
|
||||
|
||||
if (recordings.length) {
|
||||
$('#latestRecordings', page).show();
|
||||
elem.show();
|
||||
} else {
|
||||
$('#latestRecordings', page).hide();
|
||||
elem.hide();
|
||||
}
|
||||
|
||||
$('#latestRecordingItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
$('.recordingItems', elem).html(LibraryBrowser.getPosterViewHtml({
|
||||
|
||||
items: recordings,
|
||||
useAverageAspectRatio: true,
|
||||
shape: "smallBackdrop",
|
||||
shape: "square",
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
overlayText: true
|
||||
overlayText: true,
|
||||
coverImage: true
|
||||
|
||||
}));
|
||||
}
|
||||
|
@ -163,6 +65,29 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
apiClient.getLiveTvRecordings({
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
isRecording: true
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
renderRecordings($('#activeRecordings', page), result.Items);
|
||||
|
||||
});
|
||||
|
||||
apiClient.getLiveTvRecordings({
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
limit: 15,
|
||||
isRecording: false
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
renderRecordings($('#latestRecordings', page), result.Items);
|
||||
|
||||
});
|
||||
|
||||
apiClient.getLiveTvRecordingGroups({
|
||||
|
||||
userId: Dashboard.getCurrentUserId()
|
||||
|
@ -172,17 +97,6 @@
|
|||
renderRecordingGroups(page, result.Items);
|
||||
|
||||
});
|
||||
|
||||
apiClient.getLiveTvRecordings({
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
limit: 8
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
renderLatestRecordings(page, result.Items);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#liveTvRecordingsPage", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue