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-02-15 23:54:20 -05:00
parent 67f859195a
commit d8482e7870
84 changed files with 587 additions and 1881 deletions

View file

@ -1,4 +1,4 @@
define(['paperdialoghelper', 'events', 'paper-checkbox', 'jqmcollapsible', 'css!components/filterdialog/style', 'paper-radio-button', 'paper-radio-group'], function (paperDialogHelper, events) {
define(['paperdialoghelper', 'events', 'browser', 'paper-checkbox', 'jqmcollapsible', 'css!components/filterdialog/style', 'paper-radio-button', 'paper-radio-group'], function (paperDialogHelper, events, browser) {
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
@ -84,9 +84,9 @@
if (options.mode == 'livetvchannels') {
$('.chkFavorite', context).checked(query.IsFavorite == true);
$('.chkLikes', context).checked(query.IsLiked == true);
$('.chkDislikes', context).checked(query.IsDisliked == true);
context.querySelector('.chkFavorite').checked = query.IsFavorite == true;
context.querySelector('.chkLikes').checked = query.IsLiked == true;
context.querySelector('.chkDislikes').checked = query.IsDisliked == true;
} else {
$('.chkStandardFilter', context).each(function () {
@ -95,7 +95,6 @@
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
});
}
@ -107,15 +106,15 @@
this.checked = filters.indexOf(',' + filterName) != -1;
});
$('.chk3DFilter', context).checked(query.Is3D == true);
$('.chkHDFilter', context).checked(query.IsHD == true);
$('.chkSDFilter', context).checked(query.IsHD == false);
context.querySelector('.chk3DFilter').checked = query.Is3D == true;
context.querySelector('.chkHDFilter').checked = query.IsHD == true;
context.querySelector('.chkSDFilter').checked = query.IsHD == true;
$('#chkSubtitle', context).checked(query.HasSubtitles == true);
$('#chkTrailer', context).checked(query.HasTrailer == true);
$('#chkThemeSong', context).checked(query.HasThemeSong == true);
$('#chkThemeVideo', context).checked(query.HasThemeVideo == true);
$('#chkSpecialFeature', context).checked(query.HasSpecialFeature == true);
context.querySelector('#chkSubtitle').checked = query.HasSubtitles == true;
context.querySelector('#chkTrailer').checked = query.HasTrailer == true;
context.querySelector('#chkThemeSong').checked = query.HasThemeSong == true;
context.querySelector('#chkThemeVideo').checked = query.HasThemeVideo == true;
context.querySelector('#chkSpecialFeature').checked = query.HasSpecialFeature == true;
$('#chkSpecialEpisode', context).checked(query.ParentIndexNumber == 0);
$('#chkMissingEpisode', context).checked(query.IsMissing == true);
@ -513,7 +512,8 @@
modal: false,
enableHistory: false,
entryAnimationDuration: 160,
exitAnimationDuration: 200
exitAnimationDuration: 200,
autoFocus: false
});
dlg.classList.add('ui-body-a');
@ -522,28 +522,34 @@
dlg.classList.add('formDialog');
dlg.classList.add('filterDialog');
var html = '';
html += Globalize.translateDocument(template);
dlg.innerHTML = html;
dlg.innerHTML = Globalize.translateDocument(template);
setVisibility(dlg, options);
document.body.appendChild(dlg);
// needed for jqm collapsibles
$(dlg.querySelector('.filterDialogContent')).trigger('create');
$(dlg.querySelectorAll('div[data-role="collapsible"]')).collapsible({});
paperDialogHelper.open(dlg);
dlg.addEventListener('iron-overlay-closed', resolve);
updateFilterControls(dlg, options);
bindEvents(self, dlg, options);
var onTimeout = function () {
updateFilterControls(dlg, options);
bindEvents(self, dlg, options);
if (enableDynamicFilters(options.mode)) {
dlg.classList.add('dynamicFilterDialog');
loadDynamicFilters(dlg, Dashboard.getCurrentUserId(), options.query);
if (enableDynamicFilters(options.mode)) {
dlg.classList.add('dynamicFilterDialog');
loadDynamicFilters(dlg, Dashboard.getCurrentUserId(), options.query);
}
};
// In browsers without native web components (FF/IE), there are some quirks with the checkboxes appearing incorrectly with no visible checkmark
// Applying a delay after setting innerHTML seems to resolve this
if (browser.animate) {
onTimeout();
} else {
setTimeout(onTimeout, 100);
}
}

View file

@ -1,12 +1,14 @@
define(['paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-item-body', 'paper-icon-item', 'paper-textarea'], function (paperDialogHelper) {
define(['paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-item-body', 'paper-icon-item', 'paper-textarea', 'paper-fab'], function (paperDialogHelper) {
var currentDialog;
var currentContext;
var metadataEditorInfo;
var currentItem;
function closeDialog(isSubmitted) {
paperDialogHelper.close(currentDialog);
if (currentContext.tagName == 'PAPER-DIALOG') {
paperDialogHelper.close(currentContext);
}
}
function submitUpdatedItem(form, item) {
@ -259,6 +261,148 @@
});
}
function showRefreshMenu(context, button) {
var items = [];
items.push({
name: Globalize.translate('ButtonLocalRefresh'),
id: 'local',
ironIcon: 'refresh'
});
items.push({
name: Globalize.translate('ButtonAddMissingData'),
id: 'missing',
ironIcon: 'refresh'
});
items.push({
name: Globalize.translate('ButtonFullRefresh'),
id: 'full',
ironIcon: 'refresh'
});
require(['actionsheet'], function (actionsheet) {
actionsheet.show({
items: items,
positionTo: button,
callback: function (id) {
if (id) {
Dashboard.showLoadingMsg();
// For now this is a hack
setTimeout(function () {
Dashboard.hideLoadingMsg();
}, 5000);
}
switch (id) {
case 'local':
ApiClient.refreshItem(currentItem.Id, {
Recursive: true,
ImageRefreshMode: 'None',
MetadataRefreshMode: 'ValidationOnly',
ReplaceAllImages: false,
ReplaceAllMetadata: false
});
break;
case 'missing':
ApiClient.refreshItem(currentItem.Id, {
Recursive: true,
ImageRefreshMode: 'FullRefresh',
MetadataRefreshMode: 'FullRefresh',
ReplaceAllImages: false,
ReplaceAllMetadata: false
});
break;
case 'full':
ApiClient.refreshItem(currentItem.Id, {
Recursive: true,
ImageRefreshMode: 'FullRefresh',
MetadataRefreshMode: 'FullRefresh',
ReplaceAllImages: false,
ReplaceAllMetadata: true
});
break;
default:
break;
}
}
});
});
}
function showMoreMenu(context, button) {
var items = [];
items.push({
name: Globalize.translate('ButtonIdentify'),
id: 'identify',
ironIcon: 'info'
});
items.push({
name: Globalize.translate('ButtonRefresh'),
id: 'refresh',
ironIcon: 'refresh'
});
require(['actionsheet'], function (actionsheet) {
actionsheet.show({
items: items,
positionTo: button,
callback: function (id) {
switch (id) {
case 'identify':
LibraryBrowser.identifyItem(currentItem.Id);
break;
case 'refresh':
showRefreshMenu(context, button);
break;
default:
break;
}
}
});
});
}
function onWebSocketMessageReceived(e, data) {
var msg = data;
if (msg.MessageType === "LibraryChanged") {
if (msg.Data.ItemsUpdated.indexOf(currentItem.Id) != -1) {
console.log('Item updated - reloading metadata');
reload(currentContext, currentItem.Id);
}
}
}
function bindItemChanged(context) {
Events.on(ApiClient, "websocketmessage", onWebSocketMessageReceived);
}
function unbindItemChanged(context) {
Events.off(ApiClient, "websocketmessage", onWebSocketMessageReceived);
}
function init(context) {
$('.btnCancel', context).on('click', function () {
@ -266,6 +410,11 @@
closeDialog(false);
});
context.querySelector('.btnMore').addEventListener('click', function (e) {
showMoreMenu(context, e.target);
});
context.querySelector('.btnHeaderSave').addEventListener('click', function (e) {
context.querySelector('.btnSave').click();
@ -300,6 +449,11 @@
editPerson(context, {}, -1);
});
// For now this is only supported in dialog mode because we have a way of knowing when it closes
if (currentContext.tagName == 'PAPER-DIALOG') {
bindItemChanged(context);
}
}
function getItem(itemId) {
@ -1074,16 +1228,43 @@
paperDialogHelper.open(dlg);
dlg.addEventListener('iron-overlay-closed', function () {
bindItemChanged(context);
resolve();
});
currentDialog = dlg;
currentContext = dlg;
init(dlg);
reload(dlg, itemId);
}
xhr.send();
});
},
embed: function (elem, itemId) {
return new Promise(function (resolve, reject) {
Dashboard.showLoadingMsg();
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/metadataeditor/metadataeditor.template.html', true);
xhr.onload = function (e) {
var template = this.response;
elem.innerHTML = Globalize.translateDocument(template);
elem.querySelector('.btnCancel').classList.add('hide');
currentContext = elem;
init(elem);
reload(elem, itemId);
}
xhr.send();
});
}

View file

@ -3,10 +3,13 @@
<div class="dialogHeaderTitle">
${ButtonEdit}
</div>
<paper-button class="btnHeaderSave accent" tabindex="-1" style="margin-left:auto;">
<iron-icon icon="check"></iron-icon>
<span>${ButtonSave}</span>
</paper-button>
<div style="margin-left:auto; display: flex; align-items: center; justify-content: center;">
<paper-button class="btnHeaderSave accent" tabindex="-1">
<iron-icon icon="check"></iron-icon>
<span>${ButtonSave}</span>
</paper-button>
<paper-icon-button icon="more-vert" tabindex="-1" class="btnMore"></paper-icon-button>
</div>
</div>
<form class="editItemMetadataForm editMetadataForm" style="margin:0;">