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

rework identify popup

This commit is contained in:
Luke Pulverenti 2015-10-04 12:15:08 -04:00
parent 9f9f83c282
commit 9969385a5e
9 changed files with 437 additions and 364 deletions

View file

@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-meta", "homepage": "https://github.com/polymerelements/iron-meta",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
}, },
"_source": "git://github.com/PolymerElements/iron-meta.git", "_source": "git://github.com/polymerelements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-meta" "_originalSource": "polymerelements/iron-meta"
} }

View file

@ -0,0 +1,353 @@
(function ($, window, document) {
var currentItem;
var currentDeferred;
var hasChanges = false;
var currentSearchResult;
function onIdentificationFormSubmitted() {
var page = $(this).parents('.editorContent');
searchForIdentificationResults(page);
return false;
}
function searchForIdentificationResults(page) {
var lookupInfo = {
ProviderIds: {}
};
$('.identifyField', page).each(function () {
var value = this.value;
if (value) {
if (this.type == 'number') {
value = parseInt(value);
}
lookupInfo[this.getAttribute('data-lookup')] = value;
}
});
var hasId = false;
$('.txtLookupId', page).each(function () {
var value = this.value;
if (value) {
hasId = true;
}
lookupInfo.ProviderIds[this.getAttribute('data-providerkey')] = value;
});
if (!hasId && !lookupInfo.Name) {
Dashboard.alert(Globalize.translate('MessagePleaseEnterNameOrId'));
return;
}
if (currentItem.GameSystem) {
lookupInfo.GameSystem = currentItem.GameSystem;
}
lookupInfo = {
SearchInfo: lookupInfo,
IncludeDisabledProviders: true
};
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl("Items/RemoteSearch/" + currentItem.Type),
data: JSON.stringify(lookupInfo),
contentType: "application/json"
}).done(function (results) {
Dashboard.hideLoadingMsg();
showIdentificationSearchResults(page, results);
});
}
function showIdentificationSearchResults(page, results) {
$('.popupIdentifyForm', page).hide();
$('.identificationSearchResults', page).show();
$('.identifyOptionsForm', page).hide();
$('.btnIdentifyBack', page).show();
var html = '';
for (var i = 0, length = results.length; i < length; i++) {
var result = results[i];
html += getSearchResultHtml(result, i);
}
var elem = $('.identificationSearchResultList', page).html(html).trigger('create');
$('.searchImage', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-index'));
var currentResult = results[index];
showIdentifyOptions(page, currentResult);
});
}
function showIdentifyOptions(page, identifyResult) {
$('.popupIdentifyForm', page).hide();
$('.identificationSearchResults', page).hide();
$('.identifyOptionsForm', page).show();
$('.btnIdentifyBack', page).show();
$('#chkIdentifyReplaceImages', page).checked(true);
currentSearchResult = identifyResult;
var lines = [];
lines.push(identifyResult.Name);
if (identifyResult.ProductionYear) {
lines.push(identifyResult.ProductionYear);
}
if (identifyResult.GameSystem) {
lines.push(identifyResult.GameSystem);
}
var resultHtml = lines.join('<br/>');
if (identifyResult.ImageUrl) {
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
resultHtml = '<img src="' + displayUrl + '" style="max-height:160px;" /><br/>' + resultHtml;
}
$('.selectedSearchResult', page).html(resultHtml);
}
function getSearchResultHtml(result, index) {
var html = '';
var cssClass = "card";
if (currentItem.Type == "Episode") {
cssClass += " backdropCard";
}
else if (currentItem.Type == "MusicAlbum" || currentItem.Type == "MusicArtist") {
cssClass += " squareCard";
}
else {
cssClass += " portraitCard";
}
html += '<div class="' + cssClass + '">';
html += '<div class="cardScalable">';
html += '<div class="cardPadder"></div>';
html += '<a class="cardContent searchImage" href="#" data-index="' + index + '">';
if (result.ImageUrl) {
var displayUrl = getSearchImageDisplayUrl(result.ImageUrl, result.SearchProviderName);
html += '<div class="cardImage" style="background-image:url(\'' + displayUrl + '\');"></div>';
} else {
html += '<div class="cardImage iconCardImage"><iron-icon icon="search"></iron-icon></div>';
}
html += '</a>';
html += '</div>';
html += '<div class="cardFooter outerCardFooter">';
html += '<div class="cardText cardTextCentered">' + result.Name + '</div>';
html += '<div class="cardText cardTextCentered">';
html += result.ProductionYear || '&nbsp;';
html += '</div>';
if (result.GameSystem) {
html += '<div class="cardText cardTextCentered">';
html += result.GameSystem;
html += '</div>';
}
html += '</div>';
html += '</div>';
return html;
}
function getSearchImageDisplayUrl(url, provider) {
return ApiClient.getUrl("Items/RemoteSearch/Image", { imageUrl: url, ProviderName: provider });
}
function onIdentificationOptionsSubmit() {
var page = $(this).parents('.editorContent');
submitIdentficationResult(page);
return false;
}
function submitIdentficationResult(page) {
Dashboard.showLoadingMsg();
var options = {
ReplaceAllImages: $('#chkIdentifyReplaceImages', page).checked()
};
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl("Items/RemoteSearch/Apply/" + currentItem.Id, options),
data: JSON.stringify(currentSearchResult),
contentType: "application/json"
}).done(function () {
hasChanges = true;
Dashboard.hideLoadingMsg();
PaperDialogHelper.close(document.querySelector('.identifyDialog'));
}).fail(function () {
Dashboard.hideLoadingMsg();
PaperDialogHelper.close(document.querySelector('.identifyDialog'));
});
}
function initEditor(page) {
$('.popupIdentifyForm', page).off('submit', onIdentificationFormSubmitted).on('submit', onIdentificationFormSubmitted);
$('.identifyOptionsForm', page).off('submit', onIdentificationOptionsSubmit).on('submit', onIdentificationOptionsSubmit);
}
function showIdentificationForm(page, item) {
ApiClient.getJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).done(function (idList) {
var html = '';
var providerIds = item.ProviderIds || {};
for (var i = 0, length = idList.length; i < length; i++) {
var idInfo = idList[i];
var id = "txtLookup" + idInfo.Key;
html += '<div>';
var idLabel = Globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name);
var value = providerIds[idInfo.Key] || '';
html += '<paper-input class="txtLookupId" value="' + value + '" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"></paper-input>';
html += '</div>';
}
$('#txtLookupName', page).val(item.Name);
if (item.Type == "Person" || item.Type == "BoxSet") {
$('.fldLookupYear', page).hide();
$('#txtLookupYear', page).val('');
} else {
$('.fldLookupYear', page).show();
$('#txtLookupYear', page).val(item.ProductionYear);
}
$('.identifyProviderIds', page).html(html).trigger('create');
$('.identificationHeader', page).html(Globalize.translate('HeaderIdentify'));
});
}
function showEditor(itemId) {
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: 'GET',
url: 'components/itemidentifier/itemidentifier.template.html'
}).done(function (template) {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(function (item) {
currentItem = item;
var dlg = PaperDialogHelper.createDialog();
var html = '';
html += '<h2 class="dialogHeader">';
html += '<paper-fab icon="arrow-back" class="mini btnCloseDialog"></paper-fab>';
html += '<div style="display:inline-block;margin-left:.6em;vertical-align:middle;">' + Globalize.translate('HeaderIdentifyItem') + '</div>';
html += '</h2>';
html += '<div class="editorContent">';
html += Globalize.translateDocument(template);
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'itemidentifier');
var editorContent = dlg.querySelector('.editorContent');
initEditor(editorContent);
$('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg);
});
dlg.classList.add('identifyDialog');
showIdentificationForm(dlg, item);
Dashboard.hideLoadingMsg();
});
});
}
function onDialogClosed() {
$(this).remove();
Dashboard.hideLoadingMsg();
currentDeferred.resolveWith(null, [hasChanges]);
}
window.ItemIdentifier = {
show: function (itemId) {
var deferred = DeferredBuilder.Deferred();
currentDeferred = deferred;
hasChanges = false;
require(['components/paperdialoghelper'], function () {
showEditor(itemId);
});
return deferred.promise();
}
};
})(jQuery, window, document);

View file

@ -0,0 +1,38 @@
<form class="popupIdentifyForm" style="margin:auto;">
<p>${HeaderIdentifyItemHelp}</p>
<div>
<paper-input type="text" id="txtLookupName" class="identifyField" data-lookup="Name" label="${LabelName}"></paper-input>
</div>
<div class="fldLookupYear">
<paper-input type="number" id="txtLookupYear" class="identifyField" data-lookup="Year" pattern="[0-9]*" min="1800" label="${LabelYear}"></paper-input>
</div>
<div class="identifyProviderIds">
</div>
<p>
<button type="submit" data-role="none" class="clearButton">
<paper-button raised class="submit block"><iron-icon icon="search"></iron-icon><span>${ButtonSearch}</span></paper-button>
</button>
</p>
</form>
<div class="identificationSearchResults" style="display:none; text-align: center;">
<div class="identificationSearchResultList"></div>
</div>
<form class="identifyOptionsForm" style="display:none;margin:auto;">
<h1>${HeaderIdentificationResult}</h1>
<div class="selectedSearchResult"></div>
<h1>${HeaderOptions}</h1>
<div>
<paper-checkbox id="chkIdentifyReplaceImages" checked>${OptionReplaceExistingImages}</paper-checkbox>
</div>
<br />
<button type="submit" data-role="none" class="clearButton">
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSubmit}</span></paper-button>
</button>
</form>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -334,64 +334,6 @@
</form> </form>
</div> </div>
</div> </div>
<div data-role="popup" class="popupIdentify popupIdentifyItem popup" data-theme="b">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px; position: relative;">
<paper-icon-button icon="arrow-back" class="btnIdentifyBack" style="position: absolute; top: 8px; left: 10px; margin: 0;"></paper-icon-button>
<h3 class="identificationHeader">${HeaderIdentifyItem}</h3>
</div>
<div data-role="content">
<form class="popupIdentifyForm" style="max-width: initial;">
<p>${HeaderIdentifyItemHelp}</p>
<div>
<label for="txtLookupName">${LabelName}</label>
<input type="text" id="txtLookupName" class="identifyField" data-lookup="Name" />
</div>
<div class="fldLookupYear">
<label for="txtLookupYear">${LabelYear}</label>
<input type="number" id="txtLookupYear" class="identifyField" data-lookup="Year" pattern="[0-9]*" min="1800" />
</div>
<div class="identifyProviderIds">
</div>
<p>
<button type="submit" data-role="none" class="clearButton">
<paper-button raised class="submit block"><iron-icon icon="search"></iron-icon><span>${ButtonSearch}</span></paper-button>
</button>
<paper-button raised class="cancel block btnCancel" onclick="jQuery(this).parents('.popup').popup('close');"><iron-icon icon="close"></iron-icon><span>${ButtonCancel}</span></paper-button>
</p>
</form>
<div class="identificationSearchResults">
<div class="identificationSearchResultList"></div>
</div>
<form class="identifyOptionsForm" style="max-width:initial;">
<h1 style="margin-top:.25em;">${HeaderIdentificationResult}</h1>
<div class="selectedSearchResult"></div>
<h1>${HeaderOptions}</h1>
<div>
<label for="chkIdentifyReplaceImages">${OptionReplaceExistingImages}</label>
<input id="chkIdentifyReplaceImages" type="checkbox" checked="checked" data-mini="true" />
</div>
<br />
<button type="submit" data-role="none" class="clearButton">
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSubmit}</span></paper-button>
</button>
<paper-button raised class="cancel block btnCancel" onclick="jQuery(this).parents('.popup').popup('close');"><iron-icon icon="close"></iron-icon><span>${ButtonCancel}</span></paper-button>
</form>
</div>
</div>
<div data-role="popup" id="popupEditPerson" class="popup" data-theme="b"> <div data-role="popup" id="popupEditPerson" class="popup" data-theme="b">

View file

@ -280,20 +280,15 @@
$('#fldYear', page).show(); $('#fldYear', page).show();
} }
if (item.Type == "Movie" || Dashboard.getCurrentUser().done(function (user) {
item.Type == "Trailer" ||
item.Type == "Series" || if (LibraryBrowser.getMoreCommands(item, user).indexOf('identify') != -1) {
item.Type == "Game" ||
item.Type == "BoxSet" ||
item.Type == "Person" ||
item.Type == "Book" ||
item.Type == "MusicAlbum" ||
item.Type == "MusicArtist") {
$('#btnIdentify', page).show(); $('#btnIdentify', page).show();
} else { } else {
$('#btnIdentify', page).hide(); $('#btnIdentify', page).hide();
} }
});
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") { if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
$('#keywordsCollapsible', page).show(); $('#keywordsCollapsible', page).show();
@ -984,14 +979,6 @@
list.listview('refresh'); list.listview('refresh');
}; };
self.onIdentificationFormSubmitted = function () {
var page = $(this).parents('.page');
searchForIdentificationResults(page);
return false;
};
self.onRefreshFormSubmit = function () { self.onRefreshFormSubmit = function () {
var page = $(this).parents('.page'); var page = $(this).parents('.page');
@ -1006,267 +993,10 @@
savePersonInfo(page); savePersonInfo(page);
return false; return false;
}; };
self.onIdentificationOptionsSubmit = function () {
var page = $(this).parents('.page');
submitIdentficationResult(page);
return false;
};
} }
window.EditItemMetadataPage = new editItemMetadataPage(); window.EditItemMetadataPage = new editItemMetadataPage();
function showIdentificationForm(page) {
var item = currentItem;
ApiClient.getJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).done(function (idList) {
var html = '';
var providerIds = item.ProviderIds || {};
for (var i = 0, length = idList.length; i < length; i++) {
var idInfo = idList[i];
var id = "txtLookup" + idInfo.Key;
html += '<div>';
var idLabel = Globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name);
html += '<label for="' + id + '">' + idLabel + '</label>';
var value = providerIds[idInfo.Key] || '';
html += '<input class="txtLookupId" value="' + value + '" data-providerkey="' + idInfo.Key + '" id="' + id + '" data-mini="true" />';
html += '</div>';
}
$('#txtLookupName', page).val(item.Name);
if (item.Type == "Person" || item.Type == "BoxSet") {
$('.fldLookupYear', page).hide();
$('#txtLookupYear', page).val('');
} else {
$('.fldLookupYear', page).show();
$('#txtLookupYear', page).val(item.ProductionYear);
}
$('.identifyProviderIds', page).html(html).trigger('create');
$('.identificationHeader', page).html(Globalize.translate('HeaderIdentify'));
$('.popupIdentifyForm', page).show();
$('.identificationSearchResults', page).hide();
$('.identifyOptionsForm', page).hide();
$('.btnIdentifyBack', page).hide();
$('.popupIdentifyItem', page).popup('open');
});
}
function searchForIdentificationResults(page) {
var lookupInfo = {
ProviderIds: {}
};
$('.identifyField', page).each(function () {
var value = this.value;
if (value) {
if (this.type == 'number') {
value = parseInt(value);
}
lookupInfo[this.getAttribute('data-lookup')] = value;
}
});
var hasId = false;
$('.txtLookupId', page).each(function () {
var value = this.value;
if (value) {
hasId = true;
}
lookupInfo.ProviderIds[this.getAttribute('data-providerkey')] = value;
});
if (!hasId && !lookupInfo.Name) {
Dashboard.alert(Globalize.translate('MessagePleaseEnterNameOrId'));
return;
}
if (currentItem.GameSystem) {
lookupInfo.GameSystem = currentItem.GameSystem;
}
lookupInfo = {
SearchInfo: lookupInfo,
IncludeDisabledProviders: true
};
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl("Items/RemoteSearch/" + currentItem.Type),
data: JSON.stringify(lookupInfo),
contentType: "application/json"
}).done(function (results) {
Dashboard.hideLoadingMsg();
showIdentificationSearchResults(page, results);
});
}
function getSearchImageDisplayUrl(url, provider) {
return ApiClient.getUrl("Items/RemoteSearch/Image", { imageUrl: url, ProviderName: provider });
}
function getSearchResultHtml(result, index) {
var html = '';
var cssClass = "searchImageContainer remoteImageContainer";
if (currentItem.Type == "Episode") {
cssClass += " searchBackdropImageContainer";
}
else if (currentItem.Type == "MusicAlbum" || currentItem.Type == "MusicArtist") {
cssClass += " searchDiscImageContainer";
}
else {
cssClass += " searchPosterImageContainer";
}
html += '<div class="' + cssClass + '">';
if (result.ImageUrl) {
var displayUrl = getSearchImageDisplayUrl(result.ImageUrl, result.SearchProviderName);
html += '<a href="#" class="searchImage" data-index="' + index + '" style="background-image:url(\'' + displayUrl + '\');">';
} else {
html += '<a href="#" class="searchImage" data-index="' + index + '" style="background-image:url(\'css/images/items/list/remotesearch.png\');background-position: center center;">';
}
html += '</a>';
html += '<div class="remoteImageDetails">';
html += result.Name;
html += '</div>';
html += '<div class="remoteImageDetails">';
html += result.ProductionYear || '&nbsp;';
html += '</div>';
if (result.GameSystem) {
html += '<div class="remoteImageDetails">';
html += result.GameSystem;
html += '</div>';
}
html += '</div>';
return html;
}
function showIdentificationSearchResults(page, results) {
$('.popupIdentifyForm', page).hide();
$('.identificationSearchResults', page).show();
$('.identifyOptionsForm', page).hide();
$('.btnIdentifyBack', page).show();
var html = '';
for (var i = 0, length = results.length; i < length; i++) {
var result = results[i];
html += getSearchResultHtml(result, i);
}
var elem = $('.identificationSearchResultList', page).html(html).trigger('create');
$('.searchImage', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-index'));
var currentResult = results[index];
showIdentifyOptions(page, currentResult);
});
}
function showIdentifyOptions(page, identifyResult) {
$('.popupIdentifyForm', page).hide();
$('.identificationSearchResults', page).hide();
$('.identifyOptionsForm', page).show();
$('.btnIdentifyBack', page).show();
$('#chkIdentifyReplaceImages', page).checked(true).checkboxradio('refresh');
currentSearchResult = identifyResult;
var lines = [];
lines.push(identifyResult.Name);
if (identifyResult.ProductionYear) {
lines.push(identifyResult.ProductionYear);
}
if (identifyResult.GameSystem) {
lines.push(identifyResult.GameSystem);
}
var resultHtml = lines.join('<br/>');
if (identifyResult.ImageUrl) {
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
resultHtml = '<img src="' + displayUrl + '" style="max-height:160px;" /><br/>' + resultHtml;
}
$('.selectedSearchResult', page).html(resultHtml);
}
function submitIdentficationResult(page) {
Dashboard.showLoadingMsg();
var options = {
ReplaceAllImages: $('#chkIdentifyReplaceImages', page).checked()
};
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl("Items/RemoteSearch/Apply/" + currentItem.Id, options),
data: JSON.stringify(currentSearchResult),
contentType: "application/json"
}).done(function () {
Dashboard.hideLoadingMsg();
$('.popupIdentifyItem', page).popup('close');
reload(page);
});
}
function performAdvancedRefresh(page) { function performAdvancedRefresh(page) {
$('.popupAdvancedRefresh', page).popup('open'); $('.popupAdvancedRefresh', page).popup('open');
@ -1413,11 +1143,6 @@
}); });
} }
function showTab(page, index) {
$('.editorTab', page).addClass('hide')[index].classList.remove('hide');
}
$(document).on('pageinit', "#editItemMetadataPage", function () { $(document).on('pageinit', "#editItemMetadataPage", function () {
var page = this; var page = this;
@ -1429,23 +1154,7 @@
$('#btnIdentify', page).on('click', function () { $('#btnIdentify', page).on('click', function () {
showIdentificationForm(page); LibraryBrowser.identifyItem(currentItem.Id);
});
$('.btnIdentifyBack', page).on('click', function () {
if ($('.identifyOptionsForm', page).is(':visible')) {
$('.identifyOptionsForm', page).hide();
$('.identificationSearchResults', page).show();
$('.popupIdentifyForm', page).hide();
} else {
$('.identificationSearchResults', page).hide();
$('.popupIdentifyForm', page).show();
$(this).hide();
}
}); });
$('.libraryTree', page).on('itemclicked', function (event, data) { $('.libraryTree', page).on('itemclicked', function (event, data) {
@ -1464,10 +1173,8 @@
}); });
$('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit); $('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit);
$('.popupIdentifyForm').off('submit', EditItemMetadataPage.onIdentificationFormSubmitted).on('submit', EditItemMetadataPage.onIdentificationFormSubmitted);
$('.popupEditPersonForm').off('submit', EditItemMetadataPage.onPersonInfoFormSubmit).on('submit', EditItemMetadataPage.onPersonInfoFormSubmit); $('.popupEditPersonForm').off('submit', EditItemMetadataPage.onPersonInfoFormSubmit).on('submit', EditItemMetadataPage.onPersonInfoFormSubmit);
$('.popupAdvancedRefreshForm').off('submit', EditItemMetadataPage.onRefreshFormSubmit).on('submit', EditItemMetadataPage.onRefreshFormSubmit); $('.popupAdvancedRefreshForm').off('submit', EditItemMetadataPage.onRefreshFormSubmit).on('submit', EditItemMetadataPage.onRefreshFormSubmit);
$('.identifyOptionsForm').off('submit', EditItemMetadataPage.onIdentificationOptionsSubmit).on('submit', EditItemMetadataPage.onIdentificationOptionsSubmit);
$('.btnMore', page).on('click', function () { $('.btnMore', page).on('click', function () {
showMoreMenu(page, this); showMoreMenu(page, this);

View file

@ -718,6 +718,19 @@
commands.push('share'); commands.push('share');
} }
if (item.Type == "Movie" ||
item.Type == "Trailer" ||
item.Type == "Series" ||
item.Type == "Game" ||
item.Type == "BoxSet" ||
item.Type == "Person" ||
item.Type == "Book" ||
item.Type == "MusicAlbum" ||
item.Type == "MusicArtist") {
commands.push('identify');
}
return commands; return commands;
}, },
@ -842,6 +855,14 @@
}); });
} }
if (commands.indexOf('identify') != -1) {
items.push({
name: Globalize.translate('ButtonIdentify'),
id: 'identify',
ironIcon: 'info'
});
}
if (commands.indexOf('refresh') != -1) { if (commands.indexOf('refresh') != -1) {
items.push({ items.push({
name: Globalize.translate('ButtonRefresh'), name: Globalize.translate('ButtonRefresh'),
@ -899,6 +920,9 @@
case 'editimages': case 'editimages':
LibraryBrowser.editImages(itemId); LibraryBrowser.editImages(itemId);
break; break;
case 'identify':
LibraryBrowser.identifyItem(itemId);
break;
case 'refresh': case 'refresh':
ApiClient.refreshItem(itemId, { ApiClient.refreshItem(itemId, {
@ -918,6 +942,14 @@
}); });
}, },
identifyItem: function (itemId) {
require(['components/itemidentifier/itemidentifier'], function () {
ItemIdentifier.show(itemId);
});
},
getHref: function (item, context, topParentId) { getHref: function (item, context, topParentId) {
var href = LibraryBrowser.getHrefInternal(item, context); var href = LibraryBrowser.getHrefInternal(item, context);

View file

@ -1178,7 +1178,6 @@
"OptionLocalRefreshOnly": "Local refresh only", "OptionLocalRefreshOnly": "Local refresh only",
"HeaderRefreshMetadata": "Refresh Metadata", "HeaderRefreshMetadata": "Refresh Metadata",
"HeaderPersonInfo": "Person Info", "HeaderPersonInfo": "Person Info",
"HeaderIdentifyItem": "Identify Item",
"HeaderIdentifyItemHelp": "Enter one or more search criteria. Remove criteria to increase search results.", "HeaderIdentifyItemHelp": "Enter one or more search criteria. Remove criteria to increase search results.",
"HeaderConfirmDeletion": "Confirm Deletion", "HeaderConfirmDeletion": "Confirm Deletion",
"LabelFollowingFileWillBeDeleted": "The following file will be deleted:", "LabelFollowingFileWillBeDeleted": "The following file will be deleted:",

View file

@ -43,6 +43,8 @@
"TitleSync": "Sync", "TitleSync": "Sync",
"OptionAutomatic": "Auto", "OptionAutomatic": "Auto",
"HeaderSelectDate": "Select Date", "HeaderSelectDate": "Select Date",
"ButtonIdentify": "Identify",
"HeaderIdentifyItem": "Identify Item",
"LabelRecurringDonationCanBeCancelledHelp": "Recurring donations can be cancelled at any time from within your PayPal account.", "LabelRecurringDonationCanBeCancelledHelp": "Recurring donations can be cancelled at any time from within your PayPal account.",
"HeaderMyMedia": "My Media", "HeaderMyMedia": "My Media",
"ButtonRemoveFromCollection": "Remove from Collection", "ButtonRemoveFromCollection": "Remove from Collection",