mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add lyric settings to music library management
This commit is contained in:
parent
92c02f8d99
commit
931d981801
3 changed files with 73 additions and 1 deletions
|
@ -213,6 +213,39 @@ function renderSubtitleFetchers(page, availableOptions, libraryOptions) {
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderLyricFetchers(page, availableOptions, libraryOptions) {
|
||||||
|
let html = '';
|
||||||
|
const elem = page.querySelector('.lyricFetchers');
|
||||||
|
|
||||||
|
const plugins = availableOptions.LyricFetchers;
|
||||||
|
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) {
|
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
||||||
let html = '';
|
let html = '';
|
||||||
let plugins = availableTypeOptions.ImageFetchers;
|
let plugins = availableTypeOptions.ImageFetchers;
|
||||||
|
@ -282,6 +315,7 @@ function populateMetadataSettings(parent, contentType) {
|
||||||
renderMetadataReaders(parent, availableOptions.MetadataReaders);
|
renderMetadataReaders(parent, availableOptions.MetadataReaders);
|
||||||
renderMetadataFetchers(parent, availableOptions, {});
|
renderMetadataFetchers(parent, availableOptions, {});
|
||||||
renderSubtitleFetchers(parent, availableOptions, {});
|
renderSubtitleFetchers(parent, availableOptions, {});
|
||||||
|
renderLyricFetchers(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(() => {
|
||||||
|
@ -432,6 +466,12 @@ export function setContentType(parent, contentType) {
|
||||||
parent.querySelector('.fldAllowEmbeddedSubtitlesContainer').classList.add('hide');
|
parent.querySelector('.fldAllowEmbeddedSubtitlesContainer').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contentType === 'music') {
|
||||||
|
parent.querySelector('.lyricSettingsSection').classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
parent.querySelector('.lyricSettingsSection').classList.add('hide');
|
||||||
|
}
|
||||||
|
|
||||||
parent.querySelector('.chkAutomaticallyAddToCollectionContainer').classList.toggle('hide', contentType !== 'movies' && contentType !== 'mixed');
|
parent.querySelector('.chkAutomaticallyAddToCollectionContainer').classList.toggle('hide', contentType !== 'movies' && contentType !== 'mixed');
|
||||||
|
|
||||||
return populateMetadataSettings(parent, contentType);
|
return populateMetadataSettings(parent, contentType);
|
||||||
|
@ -449,6 +489,14 @@ 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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -536,6 +584,7 @@ export function getLibraryOptions(parent) {
|
||||||
SkipSubtitlesIfEmbeddedSubtitlesPresent: parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked,
|
SkipSubtitlesIfEmbeddedSubtitlesPresent: parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked,
|
||||||
SkipSubtitlesIfAudioTrackMatches: parent.querySelector('#chkSkipIfAudioTrackPresent').checked,
|
SkipSubtitlesIfAudioTrackMatches: parent.querySelector('#chkSkipIfAudioTrackPresent').checked,
|
||||||
SaveSubtitlesWithMedia: parent.querySelector('#chkSaveSubtitlesLocally').checked,
|
SaveSubtitlesWithMedia: parent.querySelector('#chkSaveSubtitlesLocally').checked,
|
||||||
|
SaveLyricsWithMedia: parent.querySelector('#chkSaveLyricsLocally').checked,
|
||||||
RequirePerfectSubtitleMatch: parent.querySelector('#chkRequirePerfectMatch').checked,
|
RequirePerfectSubtitleMatch: parent.querySelector('#chkRequirePerfectMatch').checked,
|
||||||
AutomaticallyAddToCollection: parent.querySelector('#chkAutomaticallyAddToCollection').checked,
|
AutomaticallyAddToCollection: parent.querySelector('#chkAutomaticallyAddToCollection').checked,
|
||||||
MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
||||||
|
@ -555,6 +604,7 @@ export function getLibraryOptions(parent) {
|
||||||
return elem.getAttribute('data-lang');
|
return elem.getAttribute('data-lang');
|
||||||
});
|
});
|
||||||
setSubtitleFetchersIntoOptions(parent, options);
|
setSubtitleFetchersIntoOptions(parent, options);
|
||||||
|
setLyricFetchersIntoOptions(parent, options);
|
||||||
setMetadataFetchersIntoOptions(parent, options);
|
setMetadataFetchersIntoOptions(parent, options);
|
||||||
setImageFetchersIntoOptions(parent, options);
|
setImageFetchersIntoOptions(parent, options);
|
||||||
setImageOptionsIntoOptions(options);
|
setImageOptionsIntoOptions(options);
|
||||||
|
@ -596,6 +646,7 @@ export function setLibraryOptions(parent, options) {
|
||||||
parent.querySelector('#selectAllowEmbeddedSubtitles').value = options.AllowEmbeddedSubtitles;
|
parent.querySelector('#selectAllowEmbeddedSubtitles').value = options.AllowEmbeddedSubtitles;
|
||||||
parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent;
|
parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent;
|
||||||
parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia;
|
parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia;
|
||||||
|
parent.querySelector('#chkSaveLyricsLocally').checked = options.SaveLyricsWithMedia;
|
||||||
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
|
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
|
||||||
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
|
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
|
||||||
parent.querySelector('#chkAutomaticallyAddToCollection').checked = options.AutomaticallyAddToCollection;
|
parent.querySelector('#chkAutomaticallyAddToCollection').checked = options.AutomaticallyAddToCollection;
|
||||||
|
@ -609,6 +660,7 @@ export function setLibraryOptions(parent, options) {
|
||||||
renderMetadataFetchers(parent, parent.availableOptions, options);
|
renderMetadataFetchers(parent, parent.availableOptions, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentLibraryOptions;
|
let currentLibraryOptions;
|
||||||
|
|
|
@ -193,3 +193,18 @@
|
||||||
<div class="fieldDescription checkboxFieldDescription">${SaveSubtitlesIntoMediaFoldersHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${SaveSubtitlesIntoMediaFoldersHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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" checked />
|
||||||
|
<span>${SaveLyricsIntoMediaFolders}</span>
|
||||||
|
</label>
|
||||||
|
<div class="fieldDescription checkboxFieldDescription">${SaveLyricsIntoMediaFoldersHelp}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -417,6 +417,7 @@
|
||||||
"HeaderLibrarySettings": "Library Settings",
|
"HeaderLibrarySettings": "Library Settings",
|
||||||
"HeaderLiveTvTunerSetup": "Live TV Tuner Setup",
|
"HeaderLiveTvTunerSetup": "Live TV Tuner Setup",
|
||||||
"HeaderLoginFailure": "Login Failure",
|
"HeaderLoginFailure": "Login Failure",
|
||||||
|
"HeaderLyricDownloads": "Lyric Downloads",
|
||||||
"HeaderMedia": "Media",
|
"HeaderMedia": "Media",
|
||||||
"HeaderMediaFolders": "Media Folders",
|
"HeaderMediaFolders": "Media Folders",
|
||||||
"HeaderMetadataSettings": "Metadata Settings",
|
"HeaderMetadataSettings": "Metadata Settings",
|
||||||
|
@ -706,11 +707,12 @@
|
||||||
"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.",
|
||||||
"LabelLocalHttpServerPortNumber": "Local HTTP port number",
|
"LabelLocalHttpServerPortNumber": "Local HTTP port number",
|
||||||
"LabelLocalHttpServerPortNumberHelp": "The TCP port number for the HTTP server.",
|
"LabelLocalHttpServerPortNudmberHelp": "The TCP port number for the HTTP server.",
|
||||||
"LabelLockItemToPreventChanges": "Lock this item to prevent future changes",
|
"LabelLockItemToPreventChanges": "Lock this item to prevent future changes",
|
||||||
"LabelLoginDisclaimer": "Login disclaimer",
|
"LabelLoginDisclaimer": "Login disclaimer",
|
||||||
"LabelLoginDisclaimerHelp": "A message that will be displayed at the bottom of the login page.",
|
"LabelLoginDisclaimerHelp": "A message that will be displayed at the bottom of the login page.",
|
||||||
"LabelLogs": "Logs",
|
"LabelLogs": "Logs",
|
||||||
|
"LabelLyricDownloaders": "Lyric downloaders",
|
||||||
"LabelMaxAudiobookResume": "Audiobook remaining minutes to resume",
|
"LabelMaxAudiobookResume": "Audiobook remaining minutes to resume",
|
||||||
"LabelMaxAudiobookResumeHelp": "Titles are assumed fully played if stopped when the remaining duration is less than this value.",
|
"LabelMaxAudiobookResumeHelp": "Titles are assumed fully played if stopped when the remaining duration is less than this value.",
|
||||||
"LabelMaxBackdropsPerItem": "Maximum number of backdrops per item",
|
"LabelMaxBackdropsPerItem": "Maximum number of backdrops per item",
|
||||||
|
@ -966,6 +968,7 @@
|
||||||
"Lyric": "Lyric",
|
"Lyric": "Lyric",
|
||||||
"Lyricist": "Lyricist",
|
"Lyricist": "Lyricist",
|
||||||
"Lyrics": "Lyrics",
|
"Lyrics": "Lyrics",
|
||||||
|
"LyricDownloadersHelp": "Enable and rank your preferred subtitle downloaders in order of priority.",
|
||||||
"ManageLibrary": "Manage library",
|
"ManageLibrary": "Manage library",
|
||||||
"ManageRecording": "Manage recording",
|
"ManageRecording": "Manage recording",
|
||||||
"MapChannels": "Map Channels",
|
"MapChannels": "Map Channels",
|
||||||
|
@ -1347,6 +1350,8 @@
|
||||||
"Saturday": "Saturday",
|
"Saturday": "Saturday",
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"SaveChanges": "Save changes",
|
"SaveChanges": "Save changes",
|
||||||
|
"SaveLyricsIntoMediaFolders": "Save lyrics into media folders",
|
||||||
|
"SaveLyricsIntoMediaFoldersHelp": "Storing lyrics next to audio files will allow them to be more easily managed.",
|
||||||
"SavePassword": "Save Password",
|
"SavePassword": "Save Password",
|
||||||
"SaveRecordingNFO": "Save recording EPG metadata in NFO",
|
"SaveRecordingNFO": "Save recording EPG metadata in NFO",
|
||||||
"SaveRecordingNFOHelp": "Save metadata from EPG listings provider along side media.",
|
"SaveRecordingNFOHelp": "Save metadata from EPG listings provider along side media.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue