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

update recordings

This commit is contained in:
Luke Pulverenti 2016-05-06 14:54:14 -04:00
parent 70393a9136
commit 36745b1a4a
5 changed files with 48 additions and 127 deletions

View file

@ -2425,6 +2425,11 @@
lines.push(item.ProductionYear || '');
}
if (options.showChannelName) {
lines.push(item.ChannelName || '');
}
if (options.showAirTime) {
var airTimeText;

View file

@ -229,6 +229,27 @@
}
}
function deleteTimer(id, itemsContainer) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvTimer(id).then(function () {
require(['toast'], function (toast) {
toast(Globalize.translate('MessageRecordingCancelled'));
});
Dashboard.hideLoadingMsg();
itemsContainer.dispatchEvent(new CustomEvent('timercancelled', {}));
});
});
});
}
function showContextMenu(card, options) {
var displayContextItem = card;
@ -323,8 +344,16 @@
});
}
if (itemType == 'Timer' && user.Policy.EnableLiveTvManagement) {
items.push({
name: Globalize.translate('ButtonOpen'),
name: Globalize.translate('ButtonCancel'),
id: 'canceltimer',
ironIcon: 'cancel'
});
}
items.push({
name: itemType == 'Timer' ? Globalize.translate('ButtonEdit') : Globalize.translate('ButtonOpen'),
id: 'open',
ironIcon: 'folder-open'
});
@ -581,6 +610,9 @@
case 'externalplayer':
LibraryBrowser.playInExternalPlayer(itemId);
break;
case 'canceltimer':
deleteTimer(itemId, $(card).parents('.itemsContainer')[0]);
break;
case 'share':
require(['sharingmanager'], function (sharingManager) {
sharingManager.showMenu({

View file

@ -12,108 +12,13 @@
shape: "square",
showTitle: true,
showAirTime: true,
showChannelName: true,
lazy: true,
cardLayout: true,
showDetailsMenu: true
});
return Promise.resolve(html);
return new Promise(function (resolve, reject) {
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
var html = '';
var index = '';
var imgUrl;
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
var startDateText = LibraryBrowser.getFutureDateText(datetime.parseISO8601Date(timer.StartDate, true));
if (startDateText != index) {
if (index) {
html += '</div>';
html += '</div>';
}
html += '<div class="homePageSection">';
html += '<h1>' + startDateText + '</h1>';
html += '<div class="paperList">';
index = startDateText;
}
html += '<paper-icon-item>';
var program = timer.ProgramInfo || {};
imgUrl = null;
if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: program.ImageTags.Primary,
type: "Primary"
});
}
if (imgUrl) {
html += '<paper-fab mini class="blue lazy" data-src="' + imgUrl + '" style="background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else if (program.IsKids) {
html += '<paper-fab mini style="background:#2196F3;" icon="person" item-icon></paper-fab>';
}
else if (program.IsSports) {
html += '<paper-fab mini style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
}
else if (program.IsMovie) {
html += '<paper-fab mini icon="movie" item-icon></paper-fab>';
}
else if (program.IsNews) {
html += '<paper-fab mini style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
}
else {
html += '<paper-fab mini class="blue" icon="live-tv" item-icon></paper-fab>';
}
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
html += '<div>';
html += timer.Name;
html += '</div>';
html += '<div secondary>';
html += datetime.getDisplayTime(timer.StartDate);
html += ' - ' + datetime.getDisplayTime(timer.EndDate);
html += '</div>';
html += '</a>';
html += '</paper-item-body>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
html += '</paper-icon-item>';
}
if (timers.length) {
html += '</div>';
html += '</div>';
}
resolve(html);
});
});
}
window.LiveTvHelpers = {

View file

@ -108,26 +108,6 @@
});
}
function deleteTimer(page, id) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvTimer(id).then(function () {
require(['toast'], function (toast) {
toast(Globalize.translate('MessageRecordingCancelled'));
});
reload(page);
});
});
});
}
function renderTimers(page, timers) {
LiveTvHelpers.getTimersHtml(timers).then(function (html) {
@ -143,13 +123,6 @@
elem.querySelector('.itemsContainer').innerHTML = html;
ImageLoader.lazyChildren(elem);
$('.btnDeleteTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
});
});
}
@ -181,11 +154,16 @@
});
}
window.LiveTvPage.initRecordingsTab = function (page, tabContent) {
tabContent.querySelector('#upcomingRecordings .itemsContainer').addEventListener('timercancelled', function () {
reload(tabContent);
});
};
window.LiveTvPage.renderRecordingsTab = function (page, tabContent) {
if (LibraryBrowser.needsRefresh(tabContent)) {
reload(tabContent);
}
};
});

View file

@ -165,6 +165,7 @@
break;
case 3:
depends.push('scripts/livetvrecordings');
initMethod = 'initRecordingsTab';
renderMethod = 'renderRecordingsTab';
break;
case 4: