mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add media segment providers to library options
This commit is contained in:
parent
f297392fd9
commit
5399ee1f2d
3 changed files with 55 additions and 0 deletions
|
@ -249,6 +249,40 @@ function renderLyricFetchers(page, availableOptions, libraryOptions) {
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderMediaSegmentProviders(page, availableOptions, libraryOptions) {
|
||||||
|
let html = '';
|
||||||
|
const elem = page.querySelector('.mediaSegmentProviders');
|
||||||
|
|
||||||
|
let plugins = availableOptions.MediaSegmentProviders;
|
||||||
|
plugins = getOrderedPlugins(plugins, libraryOptions.MediaSegmentProviderOrder);
|
||||||
|
elem.classList.toggle('hide', !plugins.length);
|
||||||
|
if (!plugins.length) return html;
|
||||||
|
|
||||||
|
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMediaSegmentProviders')}</h3>`;
|
||||||
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
|
for (let i = 0; i < plugins.length; i++) {
|
||||||
|
const plugin = plugins[i];
|
||||||
|
html += `<div class="listItem mediaSegmentProviderItem sortableOption" data-pluginname="${escapeHtml(plugin.Name)}">`;
|
||||||
|
const isChecked = libraryOptions.DisabledMediaSegmentProviders ? !libraryOptions.DisabledMediaSegmentProviders.includes(plugin.Name) : plugin.DefaultEnabled;
|
||||||
|
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||||
|
html += `<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkMediaSegmentProvider" data-pluginname="${escapeHtml(plugin.Name)}" ${checkedHtml}><span></span></label>`;
|
||||||
|
html += '<div class="listItemBody">';
|
||||||
|
html += '<h3 class="listItemBodyText">';
|
||||||
|
html += escapeHtml(plugin.Name);
|
||||||
|
html += '</h3>';
|
||||||
|
html += '</div>';
|
||||||
|
if (i > 0) {
|
||||||
|
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" aria-hidden="true"></span></button>`;
|
||||||
|
} else if (plugins.length > 1) {
|
||||||
|
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" aria-hidden="true"></span></button>`;
|
||||||
|
}
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
html += '</div>';
|
||||||
|
html += `<div class="fieldDescription">${globalize.translate('MediaSegmentProvidersHelp')}</div>`;
|
||||||
|
elem.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
||||||
let html = '';
|
let html = '';
|
||||||
let plugins = availableTypeOptions.ImageFetchers;
|
let plugins = availableTypeOptions.ImageFetchers;
|
||||||
|
@ -319,6 +353,7 @@ function populateMetadataSettings(parent, contentType) {
|
||||||
renderMetadataFetchers(parent, availableOptions, {});
|
renderMetadataFetchers(parent, availableOptions, {});
|
||||||
renderSubtitleFetchers(parent, availableOptions, {});
|
renderSubtitleFetchers(parent, availableOptions, {});
|
||||||
renderLyricFetchers(parent, availableOptions, {});
|
renderLyricFetchers(parent, availableOptions, {});
|
||||||
|
renderMediaSegmentProviders(parent, availableOptions, {});
|
||||||
renderImageFetchers(parent, availableOptions, {});
|
renderImageFetchers(parent, availableOptions, {});
|
||||||
availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide');
|
availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide');
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -395,6 +430,7 @@ function bindEvents(parent) {
|
||||||
parent.querySelector('.subtitleFetchers').addEventListener('click', onSortableContainerClick);
|
parent.querySelector('.subtitleFetchers').addEventListener('click', onSortableContainerClick);
|
||||||
parent.querySelector('.metadataFetchers').addEventListener('click', onSortableContainerClick);
|
parent.querySelector('.metadataFetchers').addEventListener('click', onSortableContainerClick);
|
||||||
parent.querySelector('.lyricFetchers').addEventListener('click', onSortableContainerClick);
|
parent.querySelector('.lyricFetchers').addEventListener('click', onSortableContainerClick);
|
||||||
|
parent.querySelector('.mediaSegmentProviders').addEventListener('click', onSortableContainerClick);
|
||||||
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
||||||
|
|
||||||
parent.querySelector('#chkEnableEmbeddedTitles').addEventListener('change', (e) => {
|
parent.querySelector('#chkEnableEmbeddedTitles').addEventListener('change', (e) => {
|
||||||
|
@ -510,6 +546,18 @@ function setLyricFetchersIntoOptions(parent, options) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMediaSegmentProvidersIntoOptions(parent, options) {
|
||||||
|
options.DisabledMediaSegmentProviders = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMediaSegmentProvider'), elem => {
|
||||||
|
return !elem.checked;
|
||||||
|
}), elem => {
|
||||||
|
return elem.getAttribute('data-pluginname');
|
||||||
|
});
|
||||||
|
|
||||||
|
options.MediaSegmentProviderOrder = Array.prototype.map.call(parent.querySelectorAll('.mediaSegmentProviderItem'), elem => {
|
||||||
|
return elem.getAttribute('data-pluginname');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setMetadataFetchersIntoOptions(parent, options) {
|
function setMetadataFetchersIntoOptions(parent, options) {
|
||||||
const sections = parent.querySelectorAll('.metadataFetcher');
|
const sections = parent.querySelectorAll('.metadataFetcher');
|
||||||
for (const section of sections) {
|
for (const section of sections) {
|
||||||
|
@ -623,6 +671,7 @@ export function getLibraryOptions(parent) {
|
||||||
options.DelimiterWhitelist = parent.querySelector('#tagDelimiterWhitelist').value.split('\n').filter(item => item.trim());
|
options.DelimiterWhitelist = parent.querySelector('#tagDelimiterWhitelist').value.split('\n').filter(item => item.trim());
|
||||||
setSubtitleFetchersIntoOptions(parent, options);
|
setSubtitleFetchersIntoOptions(parent, options);
|
||||||
setLyricFetchersIntoOptions(parent, options);
|
setLyricFetchersIntoOptions(parent, options);
|
||||||
|
setMediaSegmentProvidersIntoOptions(parent, options);
|
||||||
setMetadataFetchersIntoOptions(parent, options);
|
setMetadataFetchersIntoOptions(parent, options);
|
||||||
setImageFetchersIntoOptions(parent, options);
|
setImageFetchersIntoOptions(parent, options);
|
||||||
setImageOptionsIntoOptions(options);
|
setImageOptionsIntoOptions(options);
|
||||||
|
@ -684,6 +733,7 @@ export function setLibraryOptions(parent, options) {
|
||||||
renderImageFetchers(parent, parent.availableOptions, options);
|
renderImageFetchers(parent, parent.availableOptions, options);
|
||||||
renderSubtitleFetchers(parent, parent.availableOptions, options);
|
renderSubtitleFetchers(parent, parent.availableOptions, options);
|
||||||
renderLyricFetchers(parent, parent.availableOptions, options);
|
renderLyricFetchers(parent, parent.availableOptions, options);
|
||||||
|
renderMediaSegmentProviders(parent, parent.availableOptions, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentLibraryOptions;
|
let currentLibraryOptions;
|
||||||
|
|
|
@ -112,6 +112,9 @@
|
||||||
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mediaSegmentProviders advanced hide" style="margin-bottom: 2em;">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="trickplaySettingsSection hide">
|
<div class="trickplaySettingsSection hide">
|
||||||
<h2>${Trickplay}</h2>
|
<h2>${Trickplay}</h2>
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldExtractTrickplayImages">
|
<div class="checkboxContainer checkboxContainer-withDescription fldExtractTrickplayImages">
|
||||||
|
|
|
@ -754,6 +754,7 @@
|
||||||
"LabelMaxDaysForNextUpHelp": "Set the maximum amount of days a show should stay in the 'Next Up' list without watching it.",
|
"LabelMaxDaysForNextUpHelp": "Set the maximum amount of days a show should stay in the 'Next Up' list without watching it.",
|
||||||
"LabelMaxVideoResolution": "Maximum Allowed Video Transcoding Resolution",
|
"LabelMaxVideoResolution": "Maximum Allowed Video Transcoding Resolution",
|
||||||
"LabelMediaDetails": "Media details",
|
"LabelMediaDetails": "Media details",
|
||||||
|
"LabelMediaSegmentProviders": "Media segment providers",
|
||||||
"LabelMediaSegmentsType": "{0} Segments",
|
"LabelMediaSegmentsType": "{0} Segments",
|
||||||
"LabelLineup": "Lineup",
|
"LabelLineup": "Lineup",
|
||||||
"LabelLocalCustomCss": "Custom CSS code for styling which applies to this client only. You may want to disable server custom CSS code.",
|
"LabelLocalCustomCss": "Custom CSS code for styling which applies to this client only. You may want to disable server custom CSS code.",
|
||||||
|
@ -1074,6 +1075,7 @@
|
||||||
"MediaSegmentAction.None": "None",
|
"MediaSegmentAction.None": "None",
|
||||||
"MediaSegmentAction.AskToSkip": "Ask To Skip",
|
"MediaSegmentAction.AskToSkip": "Ask To Skip",
|
||||||
"MediaSegmentAction.Skip": "Skip",
|
"MediaSegmentAction.Skip": "Skip",
|
||||||
|
"MediaSegmentProvidersHelp": "Enable and rank your preferred media segment providers in order of priority.",
|
||||||
"MediaSegmentSkipPrompt": "Skip {0}",
|
"MediaSegmentSkipPrompt": "Skip {0}",
|
||||||
"MediaSegmentType.Commercial": "Commercial",
|
"MediaSegmentType.Commercial": "Commercial",
|
||||||
"MediaSegmentType.Intro": "Intro",
|
"MediaSegmentType.Intro": "Intro",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue