2020-06-09 22:28:08 +03:00
|
|
|
/* eslint-disable indent */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module for library options editor.
|
|
|
|
* @module components/libraryoptionseditor/libraryoptionseditor
|
|
|
|
*/
|
|
|
|
|
2020-08-14 08:46:34 +02:00
|
|
|
import globalize from '../../scripts/globalize';
|
|
|
|
import dom from '../../scripts/dom';
|
|
|
|
import '../../elements/emby-checkbox/emby-checkbox';
|
|
|
|
import '../../elements/emby-select/emby-select';
|
|
|
|
import '../../elements/emby-input/emby-input';
|
2020-11-25 00:17:24 -05:00
|
|
|
import template from './libraryoptionseditor.template.html';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function populateLanguages(parent) {
|
2020-06-09 22:28:08 +03:00
|
|
|
return ApiClient.getCultures().then(languages => {
|
2020-05-04 12:44:12 +02:00
|
|
|
populateLanguagesIntoSelect(parent.querySelector('#selectLanguage'), languages);
|
|
|
|
populateLanguagesIntoList(parent.querySelector('.subtitleDownloadLanguages'), languages);
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function populateLanguagesIntoSelect(select, languages) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
2018-10-23 01:05:09 +03:00
|
|
|
html += "<option value=''></option>";
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < languages.length; i++) {
|
|
|
|
const culture = languages[i];
|
|
|
|
html += `<option value='${culture.TwoLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
select.innerHTML = html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function populateLanguagesIntoList(element, languages) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
for (let i = 0; i < languages.length; i++) {
|
|
|
|
const culture = languages[i];
|
|
|
|
html += `<label><input type="checkbox" is="emby-checkbox" class="chkSubtitleLanguage" data-lang="${culture.ThreeLetterISOLanguageName.toLowerCase()}" /><span>${culture.DisplayName}</span></label>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
element.innerHTML = html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function populateCountries(select) {
|
2020-06-09 22:28:08 +03:00
|
|
|
return ApiClient.getCountries().then(allCountries => {
|
|
|
|
let html = '';
|
2018-10-23 01:05:09 +03:00
|
|
|
html += "<option value=''></option>";
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < allCountries.length; i++) {
|
|
|
|
const culture = allCountries[i];
|
|
|
|
html += `<option value='${culture.TwoLetterISORegionName}'>${culture.DisplayName}</option>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
select.innerHTML = html;
|
2020-04-05 13:48:10 +02:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function populateRefreshInterval(select) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
html += `<option value='0'>${globalize.translate('Never')}</option>`;
|
|
|
|
html += [30, 60, 90].map(val => {
|
|
|
|
return `<option value='${val}'>${globalize.translate('EveryNDays', val)}</option>`;
|
2020-05-04 12:44:12 +02:00
|
|
|
}).join('');
|
2019-05-06 17:26:18 -07:00
|
|
|
select.innerHTML = html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderMetadataReaders(page, plugins) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
const elem = page.querySelector('.metadataReaders');
|
2019-05-06 17:26:18 -07:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (plugins.length < 1) return elem.innerHTML = '', elem.classList.add('hide'), !1;
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataReaders')}</h3>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < plugins.length; i++) {
|
|
|
|
const plugin = plugins[i];
|
|
|
|
html += `<div class="listItem localReaderOption sortableOption" data-pluginname="${plugin.Name}">`;
|
2020-04-26 02:37:28 +03:00
|
|
|
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="listItemBody">';
|
|
|
|
html += '<h3 class="listItemBodyText">';
|
|
|
|
html += plugin.Name;
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</h3>';
|
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
if (i > 0) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('Up')}" class="btnSortableMoveUp btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
} else if (plugins.length > 1) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('Down')}" class="btnSortableMoveDown btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<div class="fieldDescription">${globalize.translate('LabelMetadataReadersHelp')}</div>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
if (plugins.length < 2) {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.add('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.remove('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
elem.innerHTML = html;
|
|
|
|
return true;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderMetadataSavers(page, metadataSavers) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
const elem = page.querySelector('.metadataSavers');
|
2020-05-04 12:44:12 +02:00
|
|
|
if (!metadataSavers.length) return elem.innerHTML = '', elem.classList.add('hide'), false;
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataSavers')}</h3>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < metadataSavers.length; i++) {
|
|
|
|
const plugin = metadataSavers[i];
|
|
|
|
html += `<label><input type="checkbox" data-defaultenabled="${plugin.DefaultEnabled}" is="emby-checkbox" class="chkMetadataSaver" data-pluginname="${plugin.Name}" ${false}><span>${plugin.Name}</span></label>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<div class="fieldDescription" style="margin-top:.25em;">${globalize.translate('LabelMetadataSaversHelp')}</div>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
elem.innerHTML = html;
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
return true;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getMetadataFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
let plugins = availableTypeOptions.MetadataFetchers;
|
2019-05-06 17:26:18 -07:00
|
|
|
|
|
|
|
plugins = getOrderedPlugins(plugins, libraryOptionsForType.MetadataFetcherOrder || []);
|
|
|
|
if (!plugins.length) return html;
|
|
|
|
|
|
|
|
html += '<div class="metadataFetcher" data-type="' + availableTypeOptions.Type + '">';
|
2021-11-06 13:15:45 +05:00
|
|
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('LabelTypeMetadataDownloaders', globalize.translate('TypeOptionPlural' + availableTypeOptions.Type)) + '</h3>';
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
2020-04-14 07:00:47 +02:00
|
|
|
|
2020-05-10 15:38:15 +02:00
|
|
|
plugins.forEach((plugin, index) => {
|
2018-10-23 01:05:09 +03:00
|
|
|
html += '<div class="listItem metadataFetcherItem sortableOption" data-pluginname="' + plugin.Name + '">';
|
2020-06-09 22:28:08 +03:00
|
|
|
const isChecked = libraryOptionsForType.MetadataFetchers ? libraryOptionsForType.MetadataFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
|
|
|
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkMetadataFetcher" data-pluginname="' + plugin.Name + '" ' + checkedHtml + '><span></span></label>';
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="listItemBody">';
|
|
|
|
html += '<h3 class="listItemBodyText">';
|
|
|
|
html += plugin.Name;
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</h3>';
|
|
|
|
html += '</div>';
|
2020-05-14 23:25:22 +02:00
|
|
|
if (index > 0) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('Up') + '" class="btnSortableMoveUp btnSortable" data-pluginindex="' + index + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
2020-05-14 23:25:22 +02:00
|
|
|
} else if (plugins.length > 1) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('Down') + '" class="btnSortableMoveDown btnSortable" data-pluginindex="' + index + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
2020-05-14 23:25:22 +02:00
|
|
|
}
|
|
|
|
html += '</div>';
|
2020-04-14 07:00:47 +02:00
|
|
|
});
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
|
|
|
html += '<div class="fieldDescription">' + globalize.translate('LabelMetadataDownloadersHelp') + '</div>';
|
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
return html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTypeOptions(allOptions, type) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const allTypeOptions = allOptions.TypeOptions || [];
|
|
|
|
for (let i = 0; i < allTypeOptions.length; i++) {
|
|
|
|
const typeOptions = allTypeOptions[i];
|
2019-05-06 17:26:18 -07:00
|
|
|
if (typeOptions.Type === type) return typeOptions;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
return null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderMetadataFetchers(page, availableOptions, libraryOptions) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
const elem = page.querySelector('.metadataFetchers');
|
|
|
|
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
|
|
|
const availableTypeOptions = availableOptions.TypeOptions[i];
|
2019-05-06 17:26:18 -07:00
|
|
|
html += getMetadataFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
|
|
|
}
|
|
|
|
elem.innerHTML = html;
|
|
|
|
if (html) {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.remove('hide');
|
|
|
|
page.querySelector('.fldAutoRefreshInterval').classList.remove('hide');
|
|
|
|
page.querySelector('.fldMetadataLanguage').classList.remove('hide');
|
|
|
|
page.querySelector('.fldMetadataCountry').classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.add('hide');
|
|
|
|
page.querySelector('.fldAutoRefreshInterval').classList.add('hide');
|
|
|
|
page.querySelector('.fldMetadataLanguage').classList.add('hide');
|
|
|
|
page.querySelector('.fldMetadataCountry').classList.add('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
return true;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderSubtitleFetchers(page, availableOptions, libraryOptions) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
const elem = page.querySelector('.subtitleFetchers');
|
2019-05-06 17:26:18 -07:00
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
let plugins = availableOptions.SubtitleFetchers;
|
2019-05-06 17:26:18 -07:00
|
|
|
plugins = getOrderedPlugins(plugins, libraryOptions.SubtitleFetcherOrder || []);
|
|
|
|
if (!plugins.length) return html;
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelSubtitleDownloaders')}</h3>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < plugins.length; i++) {
|
|
|
|
const plugin = plugins[i];
|
|
|
|
html += `<div class="listItem subtitleFetcherItem sortableOption" data-pluginname="${plugin.Name}">`;
|
|
|
|
const isChecked = libraryOptions.DisabledSubtitleFetchers ? !libraryOptions.DisabledSubtitleFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
|
|
|
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
|
|
|
html += `<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkSubtitleFetcher" data-pluginname="${plugin.Name}" ${checkedHtml}><span></span></label>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="listItemBody">';
|
|
|
|
html += '<h3 class="listItemBodyText">';
|
|
|
|
html += plugin.Name;
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</h3>';
|
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
if (i > 0) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('Up')}" class="btnSortableMoveUp btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
} else if (plugins.length > 1) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('Down')}" class="btnSortableMoveDown btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2020-06-09 22:28:08 +03:00
|
|
|
html += `<div class="fieldDescription">${globalize.translate('SubtitleDownloadersHelp')}</div>`;
|
2019-05-06 17:26:18 -07:00
|
|
|
elem.innerHTML = html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
let plugins = availableTypeOptions.ImageFetchers;
|
2019-05-06 17:26:18 -07:00
|
|
|
|
|
|
|
plugins = getOrderedPlugins(plugins, libraryOptionsForType.ImageFetcherOrder || []);
|
|
|
|
if (!plugins.length) return html;
|
|
|
|
|
|
|
|
html += '<div class="imageFetcher" data-type="' + availableTypeOptions.Type + '">';
|
|
|
|
html += '<div class="flex align-items-center" style="margin:1.5em 0 .5em;">';
|
2021-11-06 13:15:45 +05:00
|
|
|
html += '<h3 class="checkboxListLabel" style="margin:0;">' + globalize.translate('HeaderTypeImageFetchers', globalize.translate('TypeOptionPlural' + availableTypeOptions.Type)) + '</h3>';
|
2020-06-09 22:28:08 +03:00
|
|
|
const supportedImageTypes = availableTypeOptions.SupportedImageTypes || [];
|
2020-07-30 16:07:13 +02:00
|
|
|
if (supportedImageTypes.length > 1 || supportedImageTypes.length === 1 && supportedImageTypes[0] !== 'Primary') {
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '<button is="emby-button" class="raised btnImageOptionsForType" type="button" style="margin-left:1.5em;font-size:90%;"><span>' + globalize.translate('HeaderFetcherSettings') + '</span></button>';
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
2020-06-09 22:28:08 +03:00
|
|
|
for (let i = 0; i < plugins.length; i++) {
|
|
|
|
const plugin = plugins[i];
|
2018-10-23 01:05:09 +03:00
|
|
|
html += '<div class="listItem imageFetcherItem sortableOption" data-pluginname="' + plugin.Name + '">';
|
2020-06-09 22:28:08 +03:00
|
|
|
const isChecked = libraryOptionsForType.ImageFetchers ? libraryOptionsForType.ImageFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
|
|
|
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkImageFetcher" data-pluginname="' + plugin.Name + '" ' + checkedHtml + '><span></span></label>';
|
2019-05-06 17:26:18 -07:00
|
|
|
html += '<div class="listItemBody">';
|
|
|
|
html += '<h3 class="listItemBodyText">';
|
|
|
|
html += plugin.Name;
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</h3>';
|
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
if (i > 0) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('Up') + '" class="btnSortableMoveUp btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
2019-05-06 17:26:18 -07:00
|
|
|
} else if (plugins.length > 1) {
|
2020-08-13 21:31:29 +09:00
|
|
|
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('Down') + '" class="btnSortableMoveDown btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
|
|
|
html += '<div class="fieldDescription">' + globalize.translate('LabelImageFetchersHelp') + '</div>';
|
|
|
|
html += '</div>';
|
2019-05-06 17:26:18 -07:00
|
|
|
return html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderImageFetchers(page, availableOptions, libraryOptions) {
|
2020-06-09 22:28:08 +03:00
|
|
|
let html = '';
|
|
|
|
const elem = page.querySelector('.imageFetchers');
|
|
|
|
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
|
|
|
const availableTypeOptions = availableOptions.TypeOptions[i];
|
2019-05-06 17:26:18 -07:00
|
|
|
html += getImageFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
|
|
|
}
|
|
|
|
elem.innerHTML = html;
|
|
|
|
if (html) {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.remove('hide');
|
|
|
|
page.querySelector('.chkSaveLocalContainer').classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
elem.classList.add('hide');
|
|
|
|
page.querySelector('.chkSaveLocalContainer').classList.add('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
return true;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-06-11 22:07:24 +03:00
|
|
|
function populateMetadataSettings(parent, contentType) {
|
|
|
|
const isNewLibrary = parent.classList.contains('newlibrary');
|
2020-05-04 12:44:12 +02:00
|
|
|
return ApiClient.getJSON(ApiClient.getUrl('Libraries/AvailableOptions', {
|
2018-10-23 01:05:09 +03:00
|
|
|
LibraryContentType: contentType,
|
|
|
|
IsNewLibrary: isNewLibrary
|
2020-06-09 22:28:08 +03:00
|
|
|
})).then(availableOptions => {
|
2019-05-06 17:26:18 -07:00
|
|
|
currentAvailableOptions = availableOptions;
|
|
|
|
parent.availableOptions = availableOptions;
|
|
|
|
renderMetadataSavers(parent, availableOptions.MetadataSavers);
|
|
|
|
renderMetadataReaders(parent, availableOptions.MetadataReaders);
|
|
|
|
renderMetadataFetchers(parent, availableOptions, {});
|
|
|
|
renderSubtitleFetchers(parent, availableOptions, {});
|
|
|
|
renderImageFetchers(parent, availableOptions, {});
|
2020-05-04 12:44:12 +02:00
|
|
|
availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide');
|
2020-06-09 22:28:08 +03:00
|
|
|
}).catch(() => {
|
2019-05-06 17:26:18 -07:00
|
|
|
return Promise.resolve();
|
2020-04-05 13:48:10 +02:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function adjustSortableListElement(elem) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const btnSortable = elem.querySelector('.btnSortable');
|
|
|
|
const inner = btnSortable.querySelector('.material-icons');
|
2019-05-06 17:26:18 -07:00
|
|
|
if (elem.previousSibling) {
|
2020-08-13 21:31:29 +09:00
|
|
|
btnSortable.title = globalize.translate('Up');
|
2020-05-04 12:44:12 +02:00
|
|
|
btnSortable.classList.add('btnSortableMoveUp');
|
|
|
|
btnSortable.classList.remove('btnSortableMoveDown');
|
|
|
|
inner.classList.remove('keyboard_arrow_down');
|
|
|
|
inner.classList.add('keyboard_arrow_up');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-08-13 21:31:29 +09:00
|
|
|
btnSortable.title = globalize.translate('Down');
|
2020-05-04 12:44:12 +02:00
|
|
|
btnSortable.classList.remove('btnSortableMoveUp');
|
|
|
|
btnSortable.classList.add('btnSortableMoveDown');
|
|
|
|
inner.classList.remove('keyboard_arrow_up');
|
|
|
|
inner.classList.add('keyboard_arrow_down');
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function showImageOptionsForType(type) {
|
2020-08-14 08:46:34 +02:00
|
|
|
import('../imageOptionsEditor/imageOptionsEditor').then(({default: ImageOptionsEditor}) => {
|
2020-06-09 22:28:08 +03:00
|
|
|
let typeOptions = getTypeOptions(currentLibraryOptions, type);
|
2020-04-14 07:00:47 +02:00
|
|
|
if (!typeOptions) {
|
|
|
|
typeOptions = {
|
|
|
|
Type: type
|
|
|
|
};
|
2020-04-25 22:37:06 +02:00
|
|
|
currentLibraryOptions.TypeOptions.push(typeOptions);
|
2020-04-14 07:00:47 +02:00
|
|
|
}
|
2020-06-09 22:28:08 +03:00
|
|
|
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
2020-07-23 03:07:53 +03:00
|
|
|
const imageOptionsEditor = new ImageOptionsEditor();
|
|
|
|
imageOptionsEditor.show(type, typeOptions, availableOptions);
|
2020-04-05 13:48:10 +02:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onImageFetchersContainerClick(e) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const btnImageOptionsForType = dom.parentWithClass(e.target, 'btnImageOptionsForType');
|
2018-10-23 01:05:09 +03:00
|
|
|
if (btnImageOptionsForType) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return void showImageOptionsForType(dom.parentWithClass(btnImageOptionsForType, 'imageFetcher').getAttribute('data-type'));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
onSortableContainerClick.call(this, e);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSortableContainerClick(e) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const btnSortable = dom.parentWithClass(e.target, 'btnSortable');
|
2018-10-23 01:05:09 +03:00
|
|
|
if (btnSortable) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const li = dom.parentWithClass(btnSortable, 'sortableOption');
|
|
|
|
const list = dom.parentWithClass(li, 'paperList');
|
2020-05-04 12:44:12 +02:00
|
|
|
if (btnSortable.classList.contains('btnSortableMoveDown')) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const next = li.nextSibling;
|
2020-04-14 07:00:47 +02:00
|
|
|
if (next) {
|
|
|
|
li.parentNode.removeChild(li);
|
|
|
|
next.parentNode.insertBefore(li, next.nextSibling);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
} else {
|
2020-06-09 22:28:08 +03:00
|
|
|
const prev = li.previousSibling;
|
2020-04-14 07:00:47 +02:00
|
|
|
if (prev) {
|
|
|
|
li.parentNode.removeChild(li);
|
|
|
|
prev.parentNode.insertBefore(li, prev);
|
2020-04-25 22:37:06 +02:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
Array.prototype.forEach.call(list.querySelectorAll('.sortableOption'), adjustSortableListElement);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function bindEvents(parent) {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.metadataReaders').addEventListener('click', onSortableContainerClick);
|
|
|
|
parent.querySelector('.subtitleFetchers').addEventListener('click', onSortableContainerClick);
|
|
|
|
parent.querySelector('.metadataFetchers').addEventListener('click', onSortableContainerClick);
|
|
|
|
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-07-23 03:07:53 +03:00
|
|
|
export async function embed(parent, contentType, libraryOptions) {
|
2018-10-23 01:05:09 +03:00
|
|
|
currentLibraryOptions = {
|
|
|
|
TypeOptions: []
|
2019-05-06 17:26:18 -07:00
|
|
|
};
|
|
|
|
currentAvailableOptions = null;
|
2020-07-30 16:07:13 +02:00
|
|
|
const isNewLibrary = libraryOptions === null;
|
2020-05-04 12:44:12 +02:00
|
|
|
isNewLibrary && parent.classList.add('newlibrary');
|
2020-11-08 12:37:53 +00:00
|
|
|
|
2020-07-24 10:08:27 +09:00
|
|
|
parent.innerHTML = globalize.translateHtml(template);
|
2020-07-23 03:07:53 +03:00
|
|
|
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
|
|
|
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
|
|
|
Promise.all(promises).then(function() {
|
|
|
|
return setContentType(parent, contentType).then(function() {
|
|
|
|
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
|
|
|
bindEvents(parent);
|
|
|
|
return;
|
2020-06-09 22:28:08 +03:00
|
|
|
});
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
export function setContentType(parent, contentType) {
|
2020-05-04 12:44:12 +02:00
|
|
|
if (contentType === 'homevideos' || contentType === 'photos') {
|
|
|
|
parent.querySelector('.chkEnablePhotosContainer').classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.chkEnablePhotosContainer').classList.add('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (contentType !== 'tvshows' && contentType !== 'movies' && contentType !== 'homevideos' && contentType !== 'musicvideos' && contentType !== 'mixed') {
|
|
|
|
parent.querySelector('.chapterSettingsSection').classList.add('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.chapterSettingsSection').classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (contentType === 'tvshows') {
|
|
|
|
parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.remove('hide');
|
|
|
|
parent.querySelector('.fldSeasonZeroDisplayName').classList.remove('hide');
|
|
|
|
parent.querySelector('#txtSeasonZeroName').setAttribute('required', 'required');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.add('hide');
|
|
|
|
parent.querySelector('.fldSeasonZeroDisplayName').classList.add('hide');
|
|
|
|
parent.querySelector('#txtSeasonZeroName').removeAttribute('required');
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (contentType === 'books' || contentType === 'boxsets' || contentType === 'playlists' || contentType === 'music') {
|
|
|
|
parent.querySelector('.chkEnableEmbeddedTitlesContainer').classList.add('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.chkEnableEmbeddedTitlesContainer').classList.remove('hide');
|
2019-05-06 17:26:18 -07:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (contentType === 'tvshows') {
|
|
|
|
parent.querySelector('.chkEnableEmbeddedEpisodeInfosContainer').classList.remove('hide');
|
2020-02-17 14:56:43 +01:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('.chkEnableEmbeddedEpisodeInfosContainer').classList.add('hide');
|
2020-02-17 14:56:43 +01:00
|
|
|
}
|
2021-11-17 16:52:57 +08:00
|
|
|
|
|
|
|
parent.querySelector('.chkAutoCollectionContainer').classList.toggle('hide', contentType !== 'movies');
|
2020-02-17 14:56:43 +01:00
|
|
|
|
2019-05-06 17:26:18 -07:00
|
|
|
return populateMetadataSettings(parent, contentType);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function setSubtitleFetchersIntoOptions(parent, options) {
|
2020-06-09 22:28:08 +03:00
|
|
|
options.DisabledSubtitleFetchers = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleFetcher'), elem => {
|
2020-04-05 13:48:10 +02:00
|
|
|
return !elem.checked;
|
2020-06-09 22:28:08 +03:00
|
|
|
}), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
options.SubtitleFetcherOrder = Array.prototype.map.call(parent.querySelectorAll('.subtitleFetcherItem'), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function setMetadataFetchersIntoOptions(parent, options) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const sections = parent.querySelectorAll('.metadataFetcher');
|
|
|
|
for (let i = 0; i < sections.length; i++) {
|
|
|
|
const section = sections[i];
|
|
|
|
const type = section.getAttribute('data-type');
|
|
|
|
let typeOptions = getTypeOptions(options, type);
|
2019-05-06 17:26:18 -07:00
|
|
|
if (!typeOptions) {
|
|
|
|
typeOptions = {
|
|
|
|
Type: type
|
|
|
|
};
|
|
|
|
options.TypeOptions.push(typeOptions);
|
|
|
|
}
|
2020-06-09 22:28:08 +03:00
|
|
|
typeOptions.MetadataFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkMetadataFetcher'), elem => {
|
2019-05-06 17:26:18 -07:00
|
|
|
return elem.checked;
|
2020-06-09 22:28:08 +03:00
|
|
|
}), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
typeOptions.MetadataFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.metadataFetcherItem'), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setImageFetchersIntoOptions(parent, options) {
|
2020-06-09 22:28:08 +03:00
|
|
|
const sections = parent.querySelectorAll('.imageFetcher');
|
|
|
|
for (let i = 0; i < sections.length; i++) {
|
|
|
|
const section = sections[i];
|
|
|
|
const type = section.getAttribute('data-type');
|
|
|
|
let typeOptions = getTypeOptions(options, type);
|
2019-05-06 17:26:18 -07:00
|
|
|
if (!typeOptions) {
|
|
|
|
typeOptions = {
|
|
|
|
Type: type
|
|
|
|
};
|
|
|
|
options.TypeOptions.push(typeOptions);
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
typeOptions.ImageFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkImageFetcher'), elem => {
|
2020-04-05 13:48:10 +02:00
|
|
|
return elem.checked;
|
2020-06-09 22:28:08 +03:00
|
|
|
}), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
typeOptions.ImageFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.imageFetcherItem'), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
function setImageOptionsIntoOptions(options) {
|
|
|
|
const originalTypeOptions = (currentLibraryOptions || {}).TypeOptions || [];
|
|
|
|
for (let i = 0; i < originalTypeOptions.length; i++) {
|
|
|
|
const originalTypeOption = originalTypeOptions[i];
|
|
|
|
let typeOptions = getTypeOptions(options, originalTypeOption.Type);
|
2019-05-06 17:26:18 -07:00
|
|
|
|
|
|
|
if (!typeOptions) {
|
|
|
|
typeOptions = {
|
2020-02-26 01:39:40 -05:00
|
|
|
Type: originalTypeOption.Type
|
2019-05-06 17:26:18 -07:00
|
|
|
};
|
|
|
|
options.TypeOptions.push(typeOptions);
|
|
|
|
}
|
|
|
|
originalTypeOption.ImageOptions && (typeOptions.ImageOptions = originalTypeOption.ImageOptions);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
export function getLibraryOptions(parent) {
|
|
|
|
const options = {
|
2019-05-06 17:26:18 -07:00
|
|
|
EnableArchiveMediaFiles: false,
|
2020-05-04 12:44:12 +02:00
|
|
|
EnablePhotos: parent.querySelector('.chkEnablePhotos').checked,
|
|
|
|
EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked,
|
|
|
|
ExtractChapterImagesDuringLibraryScan: parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked,
|
|
|
|
EnableChapterImageExtraction: parent.querySelector('.chkExtractChapterImages').checked,
|
2019-05-06 17:26:18 -07:00
|
|
|
EnableInternetProviders: true,
|
2020-05-04 12:44:12 +02:00
|
|
|
SaveLocalMetadata: parent.querySelector('#chkSaveLocal').checked,
|
|
|
|
EnableAutomaticSeriesGrouping: parent.querySelector('.chkAutomaticallyGroupSeries').checked,
|
|
|
|
PreferredMetadataLanguage: parent.querySelector('#selectLanguage').value,
|
|
|
|
MetadataCountryCode: parent.querySelector('#selectCountry').value,
|
|
|
|
SeasonZeroDisplayName: parent.querySelector('#txtSeasonZeroName').value,
|
|
|
|
AutomaticRefreshIntervalDays: parseInt(parent.querySelector('#selectAutoRefreshInterval').value),
|
|
|
|
EnableEmbeddedTitles: parent.querySelector('#chkEnableEmbeddedTitles').checked,
|
|
|
|
EnableEmbeddedEpisodeInfos: parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked,
|
|
|
|
SkipSubtitlesIfEmbeddedSubtitlesPresent: parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked,
|
|
|
|
SkipSubtitlesIfAudioTrackMatches: parent.querySelector('#chkSkipIfAudioTrackPresent').checked,
|
|
|
|
SaveSubtitlesWithMedia: parent.querySelector('#chkSaveSubtitlesLocally').checked,
|
|
|
|
RequirePerfectSubtitleMatch: parent.querySelector('#chkRequirePerfectMatch').checked,
|
2021-11-17 13:52:54 +08:00
|
|
|
AutoCollection: parent.querySelector('#chkAutoCollection').checked,
|
2020-06-09 22:28:08 +03:00
|
|
|
MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
2020-04-05 13:48:10 +02:00
|
|
|
return elem.checked;
|
2020-06-09 22:28:08 +03:00
|
|
|
}), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2018-10-23 01:05:09 +03:00
|
|
|
}),
|
|
|
|
TypeOptions: []
|
|
|
|
};
|
2019-05-06 17:26:18 -07:00
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
options.LocalMetadataReaderOrder = Array.prototype.map.call(parent.querySelectorAll('.localReaderOption'), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-pluginname');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2020-06-09 22:28:08 +03:00
|
|
|
options.SubtitleDownloadLanguages = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => {
|
2020-04-05 13:48:10 +02:00
|
|
|
return elem.checked;
|
2020-06-09 22:28:08 +03:00
|
|
|
}), elem => {
|
2020-05-04 12:44:12 +02:00
|
|
|
return elem.getAttribute('data-lang');
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
setSubtitleFetchersIntoOptions(parent, options);
|
|
|
|
setMetadataFetchersIntoOptions(parent, options);
|
|
|
|
setImageFetchersIntoOptions(parent, options);
|
2020-06-09 22:28:08 +03:00
|
|
|
setImageOptionsIntoOptions(options);
|
2019-05-06 17:26:18 -07:00
|
|
|
|
|
|
|
return options;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getOrderedPlugins(plugins, configuredOrder) {
|
2019-05-06 17:26:18 -07:00
|
|
|
plugins = plugins.slice(0);
|
2020-06-09 22:28:08 +03:00
|
|
|
plugins.sort((a, b) => {
|
2020-04-05 13:48:10 +02:00
|
|
|
return a = configuredOrder.indexOf(a.Name), b = configuredOrder.indexOf(b.Name), a < b ? -1 : a > b ? 1 : 0;
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
return plugins;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
export function setLibraryOptions(parent, options) {
|
2019-05-06 17:26:18 -07:00
|
|
|
currentLibraryOptions = options;
|
|
|
|
currentAvailableOptions = parent.availableOptions;
|
2020-05-04 12:44:12 +02:00
|
|
|
parent.querySelector('#selectLanguage').value = options.PreferredMetadataLanguage || '';
|
|
|
|
parent.querySelector('#selectCountry').value = options.MetadataCountryCode || '';
|
|
|
|
parent.querySelector('#selectAutoRefreshInterval').value = options.AutomaticRefreshIntervalDays || '0';
|
|
|
|
parent.querySelector('#txtSeasonZeroName').value = options.SeasonZeroDisplayName || 'Specials';
|
|
|
|
parent.querySelector('.chkEnablePhotos').checked = options.EnablePhotos;
|
|
|
|
parent.querySelector('.chkEnableRealtimeMonitor').checked = options.EnableRealtimeMonitor;
|
|
|
|
parent.querySelector('.chkExtractChaptersDuringLibraryScan').checked = options.ExtractChapterImagesDuringLibraryScan;
|
|
|
|
parent.querySelector('.chkExtractChapterImages').checked = options.EnableChapterImageExtraction;
|
|
|
|
parent.querySelector('#chkSaveLocal').checked = options.SaveLocalMetadata;
|
|
|
|
parent.querySelector('.chkAutomaticallyGroupSeries').checked = options.EnableAutomaticSeriesGrouping;
|
|
|
|
parent.querySelector('#chkEnableEmbeddedTitles').checked = options.EnableEmbeddedTitles;
|
|
|
|
parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked = options.EnableEmbeddedEpisodeInfos;
|
|
|
|
parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent;
|
|
|
|
parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia;
|
|
|
|
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
|
|
|
|
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
|
2021-11-17 13:52:54 +08:00
|
|
|
parent.querySelector('#chkAutoCollection').checked = options.AutoCollection;
|
2020-06-09 22:28:08 +03:00
|
|
|
Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
2020-07-30 16:07:13 +02:00
|
|
|
elem.checked = options.MetadataSavers ? options.MetadataSavers.includes(elem.getAttribute('data-pluginname')) : elem.getAttribute('data-defaultenabled') === 'true';
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
2020-06-09 22:28:08 +03:00
|
|
|
Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => {
|
|
|
|
elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang'));
|
2019-05-06 17:26:18 -07:00
|
|
|
});
|
|
|
|
renderMetadataReaders(parent, getOrderedPlugins(parent.availableOptions.MetadataReaders, options.LocalMetadataReaderOrder || []));
|
|
|
|
renderMetadataFetchers(parent, parent.availableOptions, options);
|
|
|
|
renderImageFetchers(parent, parent.availableOptions, options);
|
|
|
|
renderSubtitleFetchers(parent, parent.availableOptions, options);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-05-06 17:26:18 -07:00
|
|
|
|
2020-06-09 22:28:08 +03:00
|
|
|
let currentLibraryOptions;
|
|
|
|
let currentAvailableOptions;
|
|
|
|
|
|
|
|
/* eslint-enable indent */
|
|
|
|
export default {
|
|
|
|
embed: embed,
|
|
|
|
setContentType: setContentType,
|
|
|
|
getLibraryOptions: getLibraryOptions,
|
2020-11-11 13:51:30 +01:00
|
|
|
setLibraryOptions: setLibraryOptions
|
2020-06-09 22:28:08 +03:00
|
|
|
};
|