mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update recordings
This commit is contained in:
parent
67f859195a
commit
d8482e7870
84 changed files with 587 additions and 1881 deletions
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue