mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add lyric fetcher settings to library options
This commit is contained in:
parent
722010a960
commit
00e002faeb
3 changed files with 54 additions and 0 deletions
|
@ -215,6 +215,40 @@ function renderSubtitleFetchers(page, availableOptions, libraryOptions) {
|
|||
elem.innerHTML = html;
|
||||
}
|
||||
|
||||
function renderLyricFetchers(page, availableOptions, libraryOptions) {
|
||||
let html = '';
|
||||
const elem = page.querySelector('.lyricFetchers');
|
||||
|
||||
let plugins = availableOptions.LyricFetchers;
|
||||
plugins = getOrderedPlugins(plugins, libraryOptions.LyricFetcherOrder || []);
|
||||
if (!plugins.length) return html;
|
||||
|
||||
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelLyricDownloaders')}</h3>`;
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
console.log(libraryOptions);
|
||||
for (let i = 0; i < plugins.length; i++) {
|
||||
const plugin = plugins[i];
|
||||
html += `<div class="listItem lyricFetcherItem sortableOption" data-pluginname="${escapeHtml(plugin.Name)}">`;
|
||||
const isChecked = libraryOptions.DisabledLyricFetchers ? !libraryOptions.DisabledLyricFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
html += `<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkLyricFetcher" 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('LyricDownloadersHelp')}</div>`;
|
||||
elem.innerHTML = html;
|
||||
}
|
||||
|
||||
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
||||
let html = '';
|
||||
let plugins = availableTypeOptions.ImageFetchers;
|
||||
|
@ -284,6 +318,7 @@ function populateMetadataSettings(parent, contentType) {
|
|||
renderMetadataReaders(parent, availableOptions.MetadataReaders);
|
||||
renderMetadataFetchers(parent, availableOptions, {});
|
||||
renderSubtitleFetchers(parent, availableOptions, {});
|
||||
renderLyricFetchers(parent, availableOptions, {});
|
||||
renderImageFetchers(parent, availableOptions, {});
|
||||
availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide');
|
||||
}).catch(() => {
|
||||
|
@ -460,6 +495,18 @@ function setSubtitleFetchersIntoOptions(parent, options) {
|
|||
});
|
||||
}
|
||||
|
||||
function setLyricFetchersIntoOptions(parent, options) {
|
||||
options.DisabledLyricFetchers = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkLyricFetcher'), elem => {
|
||||
return !elem.checked;
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
|
||||
options.LyricFetcherOrder = Array.prototype.map.call(parent.querySelectorAll('.lyricFetcherItem'), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
}
|
||||
|
||||
function setMetadataFetchersIntoOptions(parent, options) {
|
||||
const sections = parent.querySelectorAll('.metadataFetcher');
|
||||
for (const section of sections) {
|
||||
|
@ -567,6 +614,7 @@ export function getLibraryOptions(parent) {
|
|||
return elem.getAttribute('data-lang');
|
||||
});
|
||||
setSubtitleFetchersIntoOptions(parent, options);
|
||||
setLyricFetchersIntoOptions(parent, options);
|
||||
setMetadataFetchersIntoOptions(parent, options);
|
||||
setImageFetchersIntoOptions(parent, options);
|
||||
setImageOptionsIntoOptions(options);
|
||||
|
@ -622,6 +670,7 @@ export function setLibraryOptions(parent, options) {
|
|||
renderMetadataFetchers(parent, parent.availableOptions, options);
|
||||
renderImageFetchers(parent, parent.availableOptions, options);
|
||||
renderSubtitleFetchers(parent, parent.availableOptions, options);
|
||||
renderLyricFetchers(parent, parent.availableOptions, options);
|
||||
}
|
||||
|
||||
let currentLibraryOptions;
|
||||
|
|
|
@ -197,6 +197,9 @@
|
|||
<div class="lyricSettingsSection hide">
|
||||
<h2>${Lyrics}</h2>
|
||||
|
||||
<div class="lyricFetchers advanced" style="margin-bottom: 2em;">
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription advanced">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" id="chkSaveLyricsLocally" />
|
||||
|
|
|
@ -736,6 +736,7 @@
|
|||
"LabelLoginDisclaimer": "Login disclaimer",
|
||||
"LabelLoginDisclaimerHelp": "A message that will be displayed at the bottom of the login page.",
|
||||
"LabelLogs": "Logs",
|
||||
"LabelLyricDownloaders": "Lyric downloaders",
|
||||
"LabelMaxAudiobookResume": "Audiobook remaining minutes to resume",
|
||||
"LabelMaxAudiobookResumeHelp": "Titles are assumed fully played if stopped when the remaining duration is less than this value.",
|
||||
"LabelMaxBackdropsPerItem": "Maximum number of backdrops per item",
|
||||
|
@ -999,6 +1000,7 @@
|
|||
"Lyric": "Lyric",
|
||||
"Lyricist": "Lyricist",
|
||||
"Lyrics": "Lyrics",
|
||||
"LyricDownloadersHelp": "Enable and rank your preferred subtitle downloaders in order of priority.",
|
||||
"ManageLibrary": "Manage library",
|
||||
"ManageRecording": "Manage recording",
|
||||
"MapChannels": "Map Channels",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue