move metadata language to per library

This commit is contained in:
Luke Pulverenti 2017-01-21 18:37:38 -05:00
parent 60f00b55e9
commit befa669bc5
15 changed files with 252 additions and 278 deletions

View File

@ -1,6 +1,44 @@
define(['globalize', 'emby-checkbox'], function (globalize) { define(['globalize', 'emby-checkbox', 'emby-select'], function (globalize) {
'use strict'; 'use strict';
function populateLanguages(select) {
return ApiClient.getCultures().then(function (languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
});
}
function populateCountries(select) {
return ApiClient.getCountries().then(function (allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
});
}
function embed(parent, contentType, libraryOptions) { function embed(parent, contentType, libraryOptions) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
@ -13,13 +51,21 @@
var template = this.response; var template = this.response;
parent.innerHTML = globalize.translateDocument(template); parent.innerHTML = globalize.translateDocument(template);
setContentType(parent, contentType); var promises = [
populateLanguages(parent.querySelector('#selectLanguage')),
populateCountries(parent.querySelector('#selectCountry'))
];
if (libraryOptions) { Promise.all(promises).then(function () {
setLibraryOptions(parent, libraryOptions);
}
resolve(); setContentType(parent, contentType);
if (libraryOptions) {
setLibraryOptions(parent, libraryOptions);
}
resolve();
});
} }
xhr.send(); xhr.send();
@ -28,20 +74,18 @@
function setContentType(parent, contentType) { function setContentType(parent, contentType) {
if (contentType == 'music' || contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed' || !contentType) {
parent.querySelector('.chkArhiveAsMediaContainer').classList.add('hide');
} else {
parent.querySelector('.chkArhiveAsMediaContainer').classList.add('hide');
}
if (contentType == 'homevideos' || contentType == 'photos') { if (contentType == 'homevideos' || contentType == 'photos') {
parent.querySelector('.chkEnablePhotosContainer').classList.remove('hide'); parent.querySelector('.chkEnablePhotosContainer').classList.remove('hide');
parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.add('hide'); parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.add('hide');
parent.querySelector('.chkEnableInternetProvidersContainer').classList.add('hide'); parent.querySelector('.chkEnableInternetProvidersContainer').classList.add('hide');
parent.querySelector('.fldMetadataLanguage').classList.add('hide');
parent.querySelector('.fldMetadataCountry').classList.add('hide');
} else { } else {
parent.querySelector('.chkEnablePhotosContainer').classList.add('hide'); parent.querySelector('.chkEnablePhotosContainer').classList.add('hide');
parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.remove('hide'); parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.remove('hide');
parent.querySelector('.chkEnableInternetProvidersContainer').classList.remove('hide'); parent.querySelector('.chkEnableInternetProvidersContainer').classList.remove('hide');
parent.querySelector('.fldMetadataLanguage').classList.remove('hide');
parent.querySelector('.fldMetadataCountry').classList.remove('hide');
} }
if (contentType == 'photos') { if (contentType == 'photos') {
@ -51,11 +95,9 @@
} }
if (contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed' || !contentType) { if (contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed' || !contentType) {
parent.querySelector('.fldExtractChaptersDuringLibraryScan').classList.remove('hide'); parent.querySelector('.chapterSettingsSection').classList.remove('hide');
parent.querySelector('.fldExtractChapterImages').classList.remove('hide');
} else { } else {
parent.querySelector('.fldExtractChaptersDuringLibraryScan').classList.add('hide'); parent.querySelector('.chapterSettingsSection').classList.add('hide');
parent.querySelector('.fldExtractChapterImages').classList.add('hide');
} }
if (contentType == 'tvshows') { if (contentType == 'tvshows') {
@ -70,7 +112,7 @@
function getLibraryOptions(parent) { function getLibraryOptions(parent) {
var options = { var options = {
EnableArchiveMediaFiles: parent.querySelector('.chkArhiveAsMedia').checked, EnableArchiveMediaFiles: false,
EnablePhotos: parent.querySelector('.chkEnablePhotos').checked, EnablePhotos: parent.querySelector('.chkEnablePhotos').checked,
EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked, EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked,
ExtractChapterImagesDuringLibraryScan: parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked, ExtractChapterImagesDuringLibraryScan: parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked,
@ -79,7 +121,9 @@
EnableInternetProviders: parent.querySelector('#chkEnableInternetProviders').checked, EnableInternetProviders: parent.querySelector('#chkEnableInternetProviders').checked,
ImportMissingEpisodes: parent.querySelector('#chkImportMissingEpisodes').checked, ImportMissingEpisodes: parent.querySelector('#chkImportMissingEpisodes').checked,
SaveLocalMetadata: parent.querySelector('#chkSaveLocal').checked, SaveLocalMetadata: parent.querySelector('#chkSaveLocal').checked,
EnableAutomaticSeriesGrouping: parent.querySelector('.chkAutomaticallyGroupSeries').checked EnableAutomaticSeriesGrouping: parent.querySelector('.chkAutomaticallyGroupSeries').checked,
PreferredMetadataLanguage: parent.querySelector('#selectLanguage').value,
MetadataCountryCode: parent.querySelector('#selectCountry').value
}; };
return options; return options;
@ -87,7 +131,9 @@
function setLibraryOptions(parent, options) { function setLibraryOptions(parent, options) {
parent.querySelector('.chkArhiveAsMedia').checked = options.EnableArchiveMediaFiles; parent.querySelector('#selectLanguage').value = options.PreferredMetadataLanguage || '';
parent.querySelector('#selectCountry').value = options.MetadataCountryCode || '';
parent.querySelector('.chkEnablePhotos').checked = options.EnablePhotos; parent.querySelector('.chkEnablePhotos').checked = options.EnablePhotos;
parent.querySelector('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor; parent.querySelector('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor;
parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked = options.ExtractChapterImagesDuringLibraryScan; parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked = options.ExtractChapterImagesDuringLibraryScan;

View File

@ -1,4 +1,4 @@
<h1>${HeaderSettings}</h1> <h1>${HeaderLibrarySettings}</h1>
<div class="checkboxContainer checkboxContainer-withDescription chkEnableInternetProvidersContainer hide"> <div class="checkboxContainer checkboxContainer-withDescription chkEnableInternetProvidersContainer hide">
<label> <label>
<input is="emby-checkbox" type="checkbox" id="chkEnableInternetProviders" checked /> <input is="emby-checkbox" type="checkbox" id="chkEnableInternetProviders" checked />
@ -6,6 +6,12 @@
</label> </label>
<div class="fieldDescription checkboxFieldDescription">${LabelDownloadInternetMetadataHelp}</div> <div class="fieldDescription checkboxFieldDescription">${LabelDownloadInternetMetadataHelp}</div>
</div> </div>
<div class="selectContainer fldMetadataLanguage hide" style="margin-top:3em;">
<select is="emby-select" id="selectLanguage" label="${LabelMetadataDownloadLanguage}" required="required"></select>
</div>
<div class="selectContainer fldMetadataCountry hide">
<select is="emby-select" id="selectCountry" label="${LabelCountry}" required="required"></select>
</div>
<div class="checkboxContainer checkboxContainer-withDescription chkSaveLocalContainer hide"> <div class="checkboxContainer checkboxContainer-withDescription chkSaveLocalContainer hide">
<label> <label>
<input is="emby-checkbox" type="checkbox" id="chkSaveLocal" /> <input is="emby-checkbox" type="checkbox" id="chkSaveLocal" />
@ -23,7 +29,7 @@
<div class="checkboxContainer checkboxContainer-withDescription hide chkDownloadImagesInAdvanceContainer"> <div class="checkboxContainer checkboxContainer-withDescription hide chkDownloadImagesInAdvanceContainer">
<label> <label>
<input is="emby-checkbox" type="checkbox" id="chkDownloadImagesInAdvance"/> <input is="emby-checkbox" type="checkbox" id="chkDownloadImagesInAdvance" />
<span>${OptionDownloadImagesInAdvance}</span> <span>${OptionDownloadImagesInAdvance}</span>
</label> </label>
<div class="fieldDescription checkboxFieldDescription">${OptionDownloadImagesInAdvanceHelp}</div> <div class="fieldDescription checkboxFieldDescription">${OptionDownloadImagesInAdvanceHelp}</div>
@ -45,30 +51,6 @@
<div class="fieldDescription checkboxFieldDescription">${ImportMissingEpisodesHelp}</div> <div class="fieldDescription checkboxFieldDescription">${ImportMissingEpisodesHelp}</div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChapterImages hide">
<label>
<input type="checkbox" is="emby-checkbox" class="chkExtractChapterImages" />
<span>${OptionExtractChapterImage}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${ExtractChapterImagesHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChaptersDuringLibraryScan hide">
<label>
<input type="checkbox" is="emby-checkbox" class="chkExtractChaptersDuringLibraryScan" />
<span>${LabelExtractChaptersDuringLibraryScan}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${LabelExtractChaptersDuringLibraryScanHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription chkArhiveAsMediaContainer hide">
<label>
<input type="checkbox" is="emby-checkbox" class="chkArhiveAsMedia" />
<span>${OptionDetectArchiveFilesAsMedia}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${OptionDetectArchiveFilesAsMediaHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription chkAutomaticallyGroupSeriesContainer hide"> <div class="checkboxContainer checkboxContainer-withDescription chkAutomaticallyGroupSeriesContainer hide">
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkAutomaticallyGroupSeries" /> <input type="checkbox" is="emby-checkbox" class="chkAutomaticallyGroupSeries" />
@ -76,3 +58,22 @@
</label> </label>
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div> <div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div>
</div> </div>
<div class="chapterSettingsSection hide">
<h1>${HeaderChapterSettings}</h1>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChapterImages">
<label>
<input type="checkbox" is="emby-checkbox" class="chkExtractChapterImages" />
<span>${OptionExtractChapterImage}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${ExtractChapterImagesHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChaptersDuringLibraryScan">
<label>
<input type="checkbox" is="emby-checkbox" class="chkExtractChaptersDuringLibraryScan" />
<span>${LabelExtractChaptersDuringLibraryScan}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${LabelExtractChaptersDuringLibraryScanHelp}</div>
</div>
</div>

View File

@ -5,15 +5,23 @@
return [ return [
{ {
href: 'library.html', href: 'library.html',
name: globalize.translate('HeaderLibraries') name: Globalize.translate('HeaderLibraries')
}, },
{ {
href: 'librarydisplay.html', href: 'librarydisplay.html',
name: globalize.translate('TabDisplay') name: Globalize.translate('TabDisplay')
},
{
href: 'metadataimages.html',
name: Globalize.translate('TabMetadata')
},
{
href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings')
}, },
{ {
href: 'librarysettings.html', href: 'librarysettings.html',
name: globalize.translate('TabAdvanced') name: Globalize.translate('TabAdvanced')
}]; }];
} }

View File

@ -87,6 +87,14 @@
href: 'librarydisplay.html', href: 'librarydisplay.html',
name: Globalize.translate('TabDisplay') name: Globalize.translate('TabDisplay')
}, },
{
href: 'metadataimages.html',
name: Globalize.translate('TabMetadata')
},
{
href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings')
},
{ {
href: 'librarysettings.html', href: 'librarysettings.html',
name: Globalize.translate('TabAdvanced') name: Globalize.translate('TabAdvanced')
@ -128,7 +136,7 @@
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit); $('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
view.addEventListener('viewshow', function () { view.addEventListener('viewshow', function () {
LibraryMenu.setTabs('librarysetup', 3, getTabs); LibraryMenu.setTabs('librarysetup', 4, getTabs);
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var page = this; var page = this;

View File

@ -1,23 +0,0 @@
<div id="metadataConfigurationPage" data-role="page" class="page type-interior metadataConfigurationPage withTabs" data-require="scripts/metadataconfigurationpage,emby-checkbox,emby-button,emby-select">
<div data-role="content">
<div class="content-primary">
<form class="metadataConfigurationForm">
<div class="selectContainer">
<select is="emby-select" id="selectLanguage" label="${LabelMetadataDownloadLanguage}" required="required"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectCountry" label="${LabelCountry}" required="required"></select>
</div>
<br />
<div>
<button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button>
</div>
</form>
</div>
</div>
</div>

View File

@ -6,6 +6,18 @@
<div class="tabContent"> <div class="tabContent">
<form class="metadataImagesConfigurationForm"> <form class="metadataImagesConfigurationForm">
<h1 style="margin-top:0;">${HeaderPreferredMetadataLanguage}</h1>
<p style="margin:1.5em 0;">${DefaultMetadataLangaugeDescription}</p>
<div class="selectContainer">
<select is="emby-select" id="selectLanguage" required="required" label="${LabelLanguage}"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectCountry" required="required" label="${LabelCountry}"></select>
</div>
<div class="selectContainer"> <div class="selectContainer">
<select is="emby-select" id="selectItemType" data-mini="true" label="${LabelCustomizeOptionsPerMediaType}"></select> <select is="emby-select" id="selectItemType" data-mini="true" label="${LabelCustomizeOptionsPerMediaType}"></select>
</div> </div>
@ -23,20 +35,20 @@
<div class="collapseContent"> <div class="collapseContent">
<div class="backdropFields" style="margin-bottom: 2em; display: none;"> <div class="backdropFields" style="margin-bottom: 2em; display: none;">
<div class="inputContainer"> <div class="inputContainer">
<input is="emby-input" type="number" id="txtMaxBackdrops" pattern="[0-9]*" required="required" min="0" label="${LabelMaxBackdropsPerItem}"/> <input is="emby-input" type="number" id="txtMaxBackdrops" pattern="[0-9]*" required="required" min="0" label="${LabelMaxBackdropsPerItem}" />
</div> </div>
<div class="inputContainer"> <div class="inputContainer">
<input is="emby-input" type="number" id="txtMinBackdropDownloadWidth" pattern="[0-9]*" required="required" min="0" label="${LabelMinBackdropDownloadWidth}"/> <input is="emby-input" type="number" id="txtMinBackdropDownloadWidth" pattern="[0-9]*" required="required" min="0" label="${LabelMinBackdropDownloadWidth}" />
</div> </div>
</div> </div>
<div class="screenshotFields" style="margin-bottom: 2em; display: none;"> <div class="screenshotFields" style="margin-bottom: 2em; display: none;">
<div class="inputContainer"> <div class="inputContainer">
<input is="emby-input" type="number" id="txtMaxScreenshots" pattern="[0-9]*" required="required" min="0" label="${LabelMaxScreenshotsPerItem}"/> <input is="emby-input" type="number" id="txtMaxScreenshots" pattern="[0-9]*" required="required" min="0" label="${LabelMaxScreenshotsPerItem}" />
</div> </div>
<div class="inputContainer"> <div class="inputContainer">
<input is="emby-input" type="number" id="txtMinScreenshotDownloadWidth" pattern="[0-9]*" required="required" min="0" label="${LabelMinScreenshotDownloadWidth}"/> <input is="emby-input" type="number" id="txtMinScreenshotDownloadWidth" pattern="[0-9]*" required="required" min="0" label="${LabelMinScreenshotDownloadWidth}" />
</div> </div>
</div> </div>

View File

@ -1,52 +1,38 @@
define(['historyManager', 'jQuery'], function (historyManager, $) { define(['loading'], function (loading) {
'use strict'; 'use strict';
var currentItemId; function reload(context, itemId) {
function reload(page) { loading.show();
page = $(page)[0];
Dashboard.showLoadingMsg();
var itemId = MetadataEditor.getCurrentItemId();
currentItemId = itemId;
if (itemId) { if (itemId) {
require(['metadataEditor'], function (metadataEditor) { require(['metadataEditor'], function (metadataEditor) {
metadataEditor.embed(page.querySelector('.editPageInnerContent'), itemId, ApiClient.serverInfo().Id); metadataEditor.embed(context.querySelector('.editPageInnerContent'), itemId, ApiClient.serverInfo().Id);
}); });
} else { } else {
page.querySelector('.editPageInnerContent').innerHTML = ''; context.querySelector('.editPageInnerContent').innerHTML = '';
Dashboard.hideLoadingMsg(); loading.hide();
} }
} }
$(document).on('pageinit', "#editItemMetadataPage", function () { return function (view, params) {
var page = this; view.addEventListener('viewshow', function () {
reload(this, MetadataEditor.getCurrentItemId());
});
MetadataEditor.setCurrentItemId(null); MetadataEditor.setCurrentItemId(null);
$('.libraryTree', page).on('itemclicked', function (event, data) { view.querySelector('.libraryTree').addEventListener('itemclicked', function (event) {
if (data.id != currentItemId) { var data = event.detail;
if (data.id != MetadataEditor.getCurrentItemId()) {
MetadataEditor.setCurrentItemId(data.id); MetadataEditor.setCurrentItemId(data.id);
reload(page); reload(view, data.id);
} }
}); });
};
}).on('pageshow', "#editItemMetadataPage", function () {
var page = this;
reload(page);
}).on('pagebeforehide', "#editItemMetadataPage", function () {
var page = this;
});
}); });

View File

@ -14,7 +14,10 @@
selected: selected selected: selected
}, },
li_attr: {} li_attr: {
serveritemtype: item.Type,
collectiontype: item.CollectionType
}
}; };
if (item.IsFolder) { if (item.IsFolder) {
@ -272,11 +275,18 @@
var eventData = { var eventData = {
id: node.id, id: node.id,
itemType: node.li_attr.itemtype itemType: node.li_attr.itemtype,
serverItemType: node.li_attr.serveritemtype,
collectionType: node.li_attr.collectiontype
}; };
if (eventData.itemType != 'livetv' && eventData.itemType != 'mediafolders') { if (eventData.itemType != 'livetv' && eventData.itemType != 'mediafolders' && eventData.serverItemType != 'UserView' && eventData.serverItemType != 'CollectionFolder' && !eventData.collectionType) {
$(this).trigger('itemclicked', [eventData]);
this.dispatchEvent(new CustomEvent('itemclicked', {
detail: eventData,
bubbles: true,
cancelable: false
}));
} }
} }

View File

@ -443,6 +443,14 @@
href: 'librarydisplay.html', href: 'librarydisplay.html',
name: Globalize.translate('TabDisplay') name: Globalize.translate('TabDisplay')
}, },
{
href: 'metadataimages.html',
name: Globalize.translate('TabMetadata')
},
{
href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings')
},
{ {
href: 'librarysettings.html', href: 'librarysettings.html',
name: Globalize.translate('TabAdvanced') name: Globalize.translate('TabAdvanced')

View File

@ -1,145 +0,0 @@
define(['jQuery', 'fnchecked'], function ($) {
'use strict';
function load(page, config, allCultures, allCountries) {
if (!config || !allCultures || !allCountries) {
return;
}
$('#selectLanguage', page).val(config.PreferredMetadataLanguage);
$('#selectCountry', page).val(config.MetadataCountryCode);
Dashboard.hideLoadingMsg();
}
function onSubmit() {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().then(function (config) {
config.PreferredMetadataLanguage = $('#selectLanguage', form).val();
config.MetadataCountryCode = $('#selectCountry', form).val();
ApiClient.updateServerConfiguration(config).then(function() {
Dashboard.processServerConfigurationUpdateResult();
showConfirmMessage(config);
});
});
// Disable default form submission
return false;
}
function showConfirmMessage(config) {
var msg = [];
msg.push(Globalize.translate('MetadataSettingChangeHelp'));
if (config.DownloadImagesInAdvance) {
msg.push(Globalize.translate('DownloadImagesInAdvanceWarning'));
}
if (!msg.length) {
return;
}
require(['alert'], function (alert) {
alert({
text: msg.join('<br/><br/>')
});
});
}
function getTabs() {
return [
{
href: 'metadata.html',
name: Globalize.translate('TabSettings')
},
{
href: 'metadataimages.html',
name: Globalize.translate('TabServices')
},
{
href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings')
}];
}
$(document).on('pageinit', "#metadataConfigurationPage", function () {
Dashboard.showLoadingMsg();
$('.metadataConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshow', "#metadataConfigurationPage", function () {
LibraryMenu.setTabs('metadata', 0, getTabs);
Dashboard.showLoadingMsg();
var page = this;
var config;
var allCultures;
var allCountries;
ApiClient.getServerConfiguration().then(function (result) {
config = result;
load(page, config, allCultures, allCountries);
});
function populateLanguages(select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function populateCountries(select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
ApiClient.getCultures().then(function (result) {
populateLanguages(page.querySelector('#selectLanguage'), result);
allCultures = result;
load(page, config, allCultures, allCountries);
});
ApiClient.getCountries().then(function (result) {
populateCountries(page.querySelector('#selectCountry'), result);
allCountries = result;
load(page, config, allCultures, allCountries);
});
});
});

View File

@ -3,6 +3,44 @@
var currentType; var currentType;
function populateLanguages(select) {
return ApiClient.getCultures().then(function (languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
});
}
function populateCountries(select) {
return ApiClient.getCountries().then(function (allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
});
}
function loadTabs(page, tabs) { function loadTabs(page, tabs) {
var html = ''; var html = '';
@ -363,6 +401,19 @@
function loadPage(page) { function loadPage(page) {
var promises = [
ApiClient.getServerConfiguration(),
populateLanguages(page.querySelector('#selectLanguage')),
populateCountries(page.querySelector('#selectCountry'))
];
Promise.all(promises).then(function (responses) {
var config = responses[0];
page.querySelector('#selectLanguage').value = config.PreferredMetadataLanguage || '';
page.querySelector('#selectCountry').value = config.MetadataCountryCode || '';
});
loadTabs(page, [ loadTabs(page, [
{ name: 'OptionMovies', type: 'Movie' }, { name: 'OptionMovies', type: 'Movie' },
@ -473,6 +524,9 @@
if (metadataOptions) { if (metadataOptions) {
config.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
config.MetadataCountryCode = form.querySelector('#selectCountry').value;
saveSettingsIntoConfig(form, metadataOptions); saveSettingsIntoConfig(form, metadataOptions);
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult); ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
@ -496,16 +550,24 @@
function getTabs() { function getTabs() {
return [ return [
{ {
href: 'metadata.html', href: 'library.html',
name: Globalize.translate('TabSettings') name: Globalize.translate('HeaderLibraries')
}, },
{
href: 'librarydisplay.html',
name: Globalize.translate('TabDisplay')
},
{ {
href: 'metadataimages.html', href: 'metadataimages.html',
name: Globalize.translate('TabServices') name: Globalize.translate('TabMetadata')
}, },
{ {
href: 'metadatanfo.html', href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings') name: Globalize.translate('TabNfoSettings')
},
{
href: 'librarysettings.html',
name: Globalize.translate('TabAdvanced')
}]; }];
} }
@ -551,7 +613,7 @@
}).on('pageshow', "#metadataImagesConfigurationPage", function () { }).on('pageshow', "#metadataImagesConfigurationPage", function () {
LibraryMenu.setTabs('metadata', 1, getTabs); LibraryMenu.setTabs('metadata', 2, getTabs);
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var page = this; var page = this;

View File

@ -62,16 +62,24 @@
function getTabs() { function getTabs() {
return [ return [
{ {
href: 'metadata.html', href: 'library.html',
name: Globalize.translate('TabSettings') name: Globalize.translate('HeaderLibraries')
}, },
{
href: 'librarydisplay.html',
name: Globalize.translate('TabDisplay')
},
{ {
href: 'metadataimages.html', href: 'metadataimages.html',
name: Globalize.translate('TabServices') name: Globalize.translate('TabMetadata')
}, },
{ {
href: 'metadatanfo.html', href: 'metadatanfo.html',
name: Globalize.translate('TabNfoSettings') name: Globalize.translate('TabNfoSettings')
},
{
href: 'librarysettings.html',
name: Globalize.translate('TabAdvanced')
}]; }];
} }
@ -81,7 +89,7 @@
}).on('pageshow', "#metadataNfoPage", function () { }).on('pageshow', "#metadataNfoPage", function () {
LibraryMenu.setTabs('metadata', 2, getTabs); LibraryMenu.setTabs('metadata', 3, getTabs);
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var page = this; var page = this;

View File

@ -466,15 +466,9 @@ var Dashboard = {
divider: true, divider: true,
name: Globalize.translate('TabLibrary'), name: Globalize.translate('TabLibrary'),
href: "library.html", href: "library.html",
pageIds: ['mediaLibraryPage', 'librarySettingsPage', 'libraryDisplayPage'], pageIds: ['mediaLibraryPage', 'librarySettingsPage', 'libraryDisplayPage', 'metadataImagesConfigurationPage', 'metadataNfoPage'],
icon: 'folder', icon: 'folder',
color: '#38c' color: '#38c'
}, {
name: Globalize.translate('TabMetadata'),
href: "metadata.html",
pageIds: ['metadataConfigurationPage', 'metadataImagesConfigurationPage', 'metadataNfoPage'],
icon: 'insert_drive_file',
color: '#FF9800'
}, { }, {
name: Globalize.translate('TabSubtitles'), name: Globalize.translate('TabSubtitles'),
href: "metadatasubtitles.html", href: "metadatasubtitles.html",
@ -1704,6 +1698,7 @@ var AppInfo = {};
defineRoute({ defineRoute({
path: '/edititemmetadata.html', path: '/edititemmetadata.html',
dependencies: [], dependencies: [],
controller: 'scripts/edititemmetadata',
autoFocus: false autoFocus: false
}); });
@ -1909,13 +1904,6 @@ var AppInfo = {};
controller: 'scripts/loginpage' controller: 'scripts/loginpage'
}); });
defineRoute({
path: '/metadata.html',
dependencies: [],
autoFocus: false,
roles: 'admin'
});
defineRoute({ defineRoute({
path: '/metadataadvanced.html', path: '/metadataadvanced.html',
dependencies: [], dependencies: [],

View File

@ -296,6 +296,7 @@
"LabelRunServerAtStartupHelp": "This will start the tray icon on windows startup. To start the windows service, uncheck this and run the service from the windows control panel. Please note that you cannot run both at the same time, so you will need to exit the tray icon before starting the service.", "LabelRunServerAtStartupHelp": "This will start the tray icon on windows startup. To start the windows service, uncheck this and run the service from the windows control panel. Please note that you cannot run both at the same time, so you will need to exit the tray icon before starting the service.",
"ButtonSelectDirectory": "Select Directory", "ButtonSelectDirectory": "Select Directory",
"LabelCachePath": "Cache path:", "LabelCachePath": "Cache path:",
"DefaultMetadataLangaugeDescription": "These are your defaults and can be customized on a per-library basis.",
"LabelCachePathHelp": "Specify a custom location for server cache files, such as images. Leave blank to use the server default.", "LabelCachePathHelp": "Specify a custom location for server cache files, such as images. Leave blank to use the server default.",
"LabelRecordingPath": "Default recording path:", "LabelRecordingPath": "Default recording path:",
"LabelMovieRecordingPath": "Movie recording path (optional):", "LabelMovieRecordingPath": "Movie recording path (optional):",
@ -316,7 +317,7 @@
"LabelFanartApiKey": "Personal api key:", "LabelFanartApiKey": "Personal api key:",
"LabelFanartApiKeyHelp": "Requests to fanart without a personal API key return images that were approved over 7 days ago. With a personal API key that drops to 48 hours and if you are also a fanart VIP member that will further drop to around 10 minutes.", "LabelFanartApiKeyHelp": "Requests to fanart without a personal API key return images that were approved over 7 days ago. With a personal API key that drops to 48 hours and if you are also a fanart VIP member that will further drop to around 10 minutes.",
"ExtractChapterImagesHelp": "Extracting chapter images will allow Emby apps to display graphical scene selection menus. The process can be slow, cpu-intensive and may require several gigabytes of space. It runs when videos are discovered, and also as a nightly scheduled task. The schedule is configurable in the scheduled tasks area. It is not recommended to run this task during peak usage hours.", "ExtractChapterImagesHelp": "Extracting chapter images will allow Emby apps to display graphical scene selection menus. The process can be slow, cpu-intensive and may require several gigabytes of space. It runs when videos are discovered, and also as a nightly scheduled task. The schedule is configurable in the scheduled tasks area. It is not recommended to run this task during peak usage hours.",
"LabelMetadataDownloadLanguage": "Preferred download language:", "LabelMetadataDownloadLanguage": "Preferred metadata download language:",
"ButtonSignIn": "Sign In", "ButtonSignIn": "Sign In",
"TitleSignIn": "Sign In", "TitleSignIn": "Sign In",
"HeaderPleaseSignIn": "Please sign in", "HeaderPleaseSignIn": "Please sign in",
@ -1026,6 +1027,8 @@
"TitleDevices": "Devices", "TitleDevices": "Devices",
"TabCameraUpload": "Camera Upload", "TabCameraUpload": "Camera Upload",
"TabDevices": "Devices", "TabDevices": "Devices",
"HeaderLibrarySettings": "Library Settings",
"HeaderChapterSettings": "Chapter Settings",
"HeaderCameraUploadHelp": "Automatically upload photos and videos taken from your mobile devices into Emby.", "HeaderCameraUploadHelp": "Automatically upload photos and videos taken from your mobile devices into Emby.",
"MessageNoDevicesSupportCameraUpload": "You currently don't have any devices that support camera upload.", "MessageNoDevicesSupportCameraUpload": "You currently don't have any devices that support camera upload.",
"LabelCameraUploadPath": "Camera upload path:", "LabelCameraUploadPath": "Camera upload path:",

View File

@ -6,6 +6,8 @@
<form class="wizardSettingsForm"> <form class="wizardSettingsForm">
<h1>${HeaderPreferredMetadataLanguage}</h1> <h1>${HeaderPreferredMetadataLanguage}</h1>
<p style="margin:1.5em 0;">${DefaultMetadataLangaugeDescription}</p>
<div class="selectContainer"> <div class="selectContainer">
<select is="emby-select" id="selectLanguage" required="required" label="${LabelLanguage}"></select> <select is="emby-select" id="selectLanguage" required="required" label="${LabelLanguage}"></select>
</div> </div>