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

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';
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) {
return new Promise(function (resolve, reject) {
@ -13,13 +51,21 @@
var template = this.response;
parent.innerHTML = globalize.translateDocument(template);
setContentType(parent, contentType);
var promises = [
populateLanguages(parent.querySelector('#selectLanguage')),
populateCountries(parent.querySelector('#selectCountry'))
];
if (libraryOptions) {
setLibraryOptions(parent, libraryOptions);
}
Promise.all(promises).then(function () {
resolve();
setContentType(parent, contentType);
if (libraryOptions) {
setLibraryOptions(parent, libraryOptions);
}
resolve();
});
}
xhr.send();
@ -28,20 +74,18 @@
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') {
parent.querySelector('.chkEnablePhotosContainer').classList.remove('hide');
parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.add('hide');
parent.querySelector('.chkEnableInternetProvidersContainer').classList.add('hide');
parent.querySelector('.fldMetadataLanguage').classList.add('hide');
parent.querySelector('.fldMetadataCountry').classList.add('hide');
} else {
parent.querySelector('.chkEnablePhotosContainer').classList.add('hide');
parent.querySelector('.chkDownloadImagesInAdvanceContainer').classList.remove('hide');
parent.querySelector('.chkEnableInternetProvidersContainer').classList.remove('hide');
parent.querySelector('.fldMetadataLanguage').classList.remove('hide');
parent.querySelector('.fldMetadataCountry').classList.remove('hide');
}
if (contentType == 'photos') {
@ -51,11 +95,9 @@
}
if (contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed' || !contentType) {
parent.querySelector('.fldExtractChaptersDuringLibraryScan').classList.remove('hide');
parent.querySelector('.fldExtractChapterImages').classList.remove('hide');
parent.querySelector('.chapterSettingsSection').classList.remove('hide');
} else {
parent.querySelector('.fldExtractChaptersDuringLibraryScan').classList.add('hide');
parent.querySelector('.fldExtractChapterImages').classList.add('hide');
parent.querySelector('.chapterSettingsSection').classList.add('hide');
}
if (contentType == 'tvshows') {
@ -70,7 +112,7 @@
function getLibraryOptions(parent) {
var options = {
EnableArchiveMediaFiles: parent.querySelector('.chkArhiveAsMedia').checked,
EnableArchiveMediaFiles: false,
EnablePhotos: parent.querySelector('.chkEnablePhotos').checked,
EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked,
ExtractChapterImagesDuringLibraryScan: parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked,
@ -79,7 +121,9 @@
EnableInternetProviders: parent.querySelector('#chkEnableInternetProviders').checked,
ImportMissingEpisodes: parent.querySelector('#chkImportMissingEpisodes').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;
@ -87,7 +131,9 @@
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('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor;
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">
<label>
<input is="emby-checkbox" type="checkbox" id="chkEnableInternetProviders" checked />
@ -6,6 +6,12 @@
</label>
<div class="fieldDescription checkboxFieldDescription">${LabelDownloadInternetMetadataHelp}</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">
<label>
<input is="emby-checkbox" type="checkbox" id="chkSaveLocal" />
@ -23,7 +29,7 @@
<div class="checkboxContainer checkboxContainer-withDescription hide chkDownloadImagesInAdvanceContainer">
<label>
<input is="emby-checkbox" type="checkbox" id="chkDownloadImagesInAdvance"/>
<input is="emby-checkbox" type="checkbox" id="chkDownloadImagesInAdvance" />
<span>${OptionDownloadImagesInAdvance}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${OptionDownloadImagesInAdvanceHelp}</div>
@ -45,30 +51,6 @@
<div class="fieldDescription checkboxFieldDescription">${ImportMissingEpisodesHelp}</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">
<label>
<input type="checkbox" is="emby-checkbox" class="chkAutomaticallyGroupSeries" />
@ -76,3 +58,22 @@
</label>
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</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>