diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index a44cd9947c..67c8e3a012 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -249,6 +249,40 @@ function renderLyricFetchers(page, availableOptions, libraryOptions) { 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 += `

${globalize.translate('LabelMediaSegmentProviders')}

`; + html += '
'; + for (let i = 0; i < plugins.length; i++) { + const plugin = plugins[i]; + html += `
`; + const isChecked = libraryOptions.DisabledMediaSegmentProviders ? !libraryOptions.DisabledMediaSegmentProviders.includes(plugin.Name) : plugin.DefaultEnabled; + const checkedHtml = isChecked ? ' checked="checked"' : ''; + html += ``; + html += '
'; + html += '

'; + html += escapeHtml(plugin.Name); + html += '

'; + html += '
'; + if (i > 0) { + html += ``; + } else if (plugins.length > 1) { + html += ``; + } + html += '
'; + } + html += '
'; + html += `
${globalize.translate('MediaSegmentProvidersHelp')}
`; + elem.innerHTML = html; +} + function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) { let html = ''; let plugins = availableTypeOptions.ImageFetchers; @@ -319,6 +353,7 @@ function populateMetadataSettings(parent, contentType) { renderMetadataFetchers(parent, availableOptions, {}); renderSubtitleFetchers(parent, availableOptions, {}); renderLyricFetchers(parent, availableOptions, {}); + renderMediaSegmentProviders(parent, availableOptions, {}); renderImageFetchers(parent, availableOptions, {}); availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide'); }).catch(() => { @@ -395,6 +430,7 @@ function bindEvents(parent) { parent.querySelector('.subtitleFetchers').addEventListener('click', onSortableContainerClick); parent.querySelector('.metadataFetchers').addEventListener('click', onSortableContainerClick); parent.querySelector('.lyricFetchers').addEventListener('click', onSortableContainerClick); + parent.querySelector('.mediaSegmentProviders').addEventListener('click', onSortableContainerClick); parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick); 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) { const sections = parent.querySelectorAll('.metadataFetcher'); 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()); setSubtitleFetchersIntoOptions(parent, options); setLyricFetchersIntoOptions(parent, options); + setMediaSegmentProvidersIntoOptions(parent, options); setMetadataFetchersIntoOptions(parent, options); setImageFetchersIntoOptions(parent, options); setImageOptionsIntoOptions(options); @@ -684,6 +733,7 @@ export function setLibraryOptions(parent, options) { renderImageFetchers(parent, parent.availableOptions, options); renderSubtitleFetchers(parent, parent.availableOptions, options); renderLyricFetchers(parent, parent.availableOptions, options); + renderMediaSegmentProviders(parent, parent.availableOptions, options); } let currentLibraryOptions; diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index faebbb6549..f487bc482b 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -112,6 +112,9 @@
${OptionAutomaticallyGroupSeriesHelp}
+
+
+

${Trickplay}

diff --git a/src/strings/en-us.json b/src/strings/en-us.json index a2ef7d9843..5b5dbff13e 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -754,6 +754,7 @@ "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", "LabelMediaDetails": "Media details", + "LabelMediaSegmentProviders": "Media segment providers", "LabelMediaSegmentsType": "{0} Segments", "LabelLineup": "Lineup", "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.AskToSkip": "Ask To Skip", "MediaSegmentAction.Skip": "Skip", + "MediaSegmentProvidersHelp": "Enable and rank your preferred media segment providers in order of priority.", "MediaSegmentSkipPrompt": "Skip {0}", "MediaSegmentType.Commercial": "Commercial", "MediaSegmentType.Intro": "Intro",