From 524ede412b1fd1d7c9b1ee89274c11ce4225c30a Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 4 Aug 2024 12:54:39 +0800 Subject: [PATCH 1/4] Add non-standard multi-value audio tag support --- .../libraryoptionseditor.js | 11 ++++++++ .../libraryoptionseditor.template.html | 26 +++++++++++++++++++ src/strings/en-us.json | 4 +++ 3 files changed, 41 insertions(+) diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index de70c1c1a94..73784097d9b 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -12,6 +12,7 @@ import dom from '../../scripts/dom'; import '../../elements/emby-checkbox/emby-checkbox'; import '../../elements/emby-select/emby-select'; import '../../elements/emby-input/emby-input'; +import '../../elements/emby-textarea/emby-textarea'; import './style.scss'; import template from './libraryoptionseditor.template.html'; @@ -439,8 +440,10 @@ export function setContentType(parent, contentType) { if (contentType === 'music') { parent.querySelector('.lyricSettingsSection').classList.remove('hide'); + parent.querySelector('.audioTagSettingsSection').classList.remove('hide'); } else { parent.querySelector('.lyricSettingsSection').classList.add('hide'); + parent.querySelector('.audioTagSettingsSection').classList.add('hide'); } parent.querySelector('.chkAutomaticallyAddToCollectionContainer').classList.toggle('hide', contentType !== 'movies' && contentType !== 'mixed'); @@ -550,6 +553,8 @@ export function getLibraryOptions(parent) { SaveLyricsWithMedia: parent.querySelector('#chkSaveLyricsLocally').checked, RequirePerfectSubtitleMatch: parent.querySelector('#chkRequirePerfectMatch').checked, AutomaticallyAddToCollection: parent.querySelector('#chkAutomaticallyAddToCollection').checked, + PreferNonstandardArtistsTag: parent.querySelector('#chkPreferNonstandardArtistsTag').checked, + UseCustomTagDelimiters: parent.querySelector('#chkUseCustomTagDelimiters').checked, MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), elem => { return elem.checked; }), elem => { @@ -566,6 +571,8 @@ export function getLibraryOptions(parent) { }), elem => { return elem.getAttribute('data-lang'); }); + options.CustomTagDelimiters = parent.querySelector('#customTagDelimitersInput').value.split(''); + options.DelimiterWhitelist = parent.querySelector('#tagDelimiterWhitelist').value.split('\n'); setSubtitleFetchersIntoOptions(parent, options); setMetadataFetchersIntoOptions(parent, options); setImageFetchersIntoOptions(parent, options); @@ -612,12 +619,16 @@ export function setLibraryOptions(parent, options) { parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches; parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch; parent.querySelector('#chkAutomaticallyAddToCollection').checked = options.AutomaticallyAddToCollection; + parent.querySelector('#chkPreferNonstandardArtistsTag').checked = options.PreferNonstandardArtistsTag; + parent.querySelector('#chkUseCustomTagDelimiters').checked = options.UseCustomTagDelimiters; Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), elem => { elem.checked = options.MetadataSavers ? options.MetadataSavers.includes(elem.getAttribute('data-pluginname')) : elem.getAttribute('data-defaultenabled') === 'true'; }); Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => { elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang')); }); + parent.querySelector('#customTagDelimitersInput').value = options.CustomTagDelimiters.join(''); + parent.querySelector('#tagDelimiterWhitelist').value = options.DelimiterWhitelist.join('\n').filter(item => item.trim()); renderMetadataReaders(parent, getOrderedPlugins(parent.availableOptions.MetadataReaders, options.LocalMetadataReaderOrder || [])); renderMetadataFetchers(parent, parent.availableOptions, options); renderImageFetchers(parent, parent.availableOptions, options); diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index b1d358cc026..28c711cbd34 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -205,3 +205,29 @@

${Lyrics}

${SaveLyricsIntoMediaFoldersHelp}
+ +
+

Audio Tag settings

+
+ +
${PreferNonstandardArtistsTagHelp}
+
+
+ +
${UseCustomTagDelimitersHelp}
+
+
+ +
${LabelcustomTagDelimitersHelp}
+
+
+ +
${LabelDelimiterWhitelistHelp}
+
+
diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 12023468eb2..b45c9e6351e 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -615,6 +615,7 @@ "LabelCustomCssHelp": "Apply your custom CSS code for theming/branding on the web interface.", "LabelCustomDeviceDisplayNameHelp": "Supply a custom display name or leave empty to use the name reported by the device.", "LabelCustomRating": "Custom rating", + "LabelcustomTagDelimitersHelp": "Characters to be treated as delimiters to separate tags.", "LabelDashboardTheme": "Server Dashboard theme", "LabelDate": "Date", "LabelDateAdded": "Date added", @@ -625,6 +626,7 @@ "LabelDeathDate": "Death date", "LabelDefaultScreen": "Default screen", "LabelDeinterlaceMethod": "Deinterlacing method", + "LabelDelimiterWhitelistHelp": "Items to be excluded from tag splitting. One item per line.", "LabelDeveloper": "Developer", "LabelDisableCustomCss": "Disable custom CSS code for theming/branding provided from the server.", "LabelDiscNumber": "Disc number", @@ -1301,6 +1303,7 @@ "PreferEmbeddedExtrasTitlesOverFileNamesHelp": "Extras often have the same embedded name as the parent, check this to use embedded titles for them anyway.", "PreferEmbeddedTitlesOverFileNames": "Prefer embedded titles over filenames", "PreferEmbeddedTitlesOverFileNamesHelp": "Determine the display title to use when no internet metadata or local metadata is available.", + "PreferNonstandardArtistsTagHelp": "Use the non-standard ARTISTS tag instead of ARTIST tag when available.", "AllowEmbeddedSubtitles": "Disable different types of embedded subtitles", "AllowEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers. Requires a full library refresh.", "AllowEmbeddedSubtitlesAllowAllOption": "Allow All", @@ -1529,6 +1532,7 @@ "UnsupportedPlayback": "Jellyfin cannot decrypt content protected by DRM but all content will be tried regardless, including protected titles. Some files may appear completely black due to encryption or other unsupported features, such as interactive titles.", "Up": "Up", "Upload": "Upload", + "UseCustomTagDelimitersHelp": "Split artist/genre tags with custom characters.", "UseDoubleRateDeinterlacing": "Double the frame rate when deinterlacing", "UseDoubleRateDeinterlacingHelp": "This setting uses the field rate when deinterlacing, often referred to as bob deinterlacing, which doubles the frame rate of the video to provide full motion like what you would see when viewing interlaced video on a TV.", "UseEpisodeImagesInNextUp": "Use episode images in 'Next Up' and 'Continue Watching' sections", From f6c8af1095af7c2e70e7207179e0518fb1c227d3 Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 4 Aug 2024 15:31:43 +0800 Subject: [PATCH 2/4] Make labels translatable --- .../libraryoptionseditor.template.html | 10 +++++----- src/strings/en-us.json | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index 28c711cbd34..e1793fdd1dd 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -207,27 +207,27 @@

${Lyrics}

-

Audio Tag settings

+

${LabelAudioTagSettings}

${PreferNonstandardArtistsTagHelp}
${UseCustomTagDelimitersHelp}
- +
${LabelcustomTagDelimitersHelp}
- +
${LabelDelimiterWhitelistHelp}
diff --git a/src/strings/en-us.json b/src/strings/en-us.json index b45c9e6351e..cf68b5591b6 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -565,6 +565,7 @@ "LabelAudioChannels": "Audio channels", "LabelAudioCodec": "Audio codec", "LabelAudioLanguagePreference": "Preferred audio language", + "LabelAudioTagSettings": "Audio Tag settings", "LabelSelectAudioNormalization": "Audio Normalization", "LabelSelectPreferredTranscodeVideoAudioCodec": "Preferred transcode audio codec in video playback", "LabelAudioSampleRate": "Audio sample rate", @@ -615,6 +616,7 @@ "LabelCustomCssHelp": "Apply your custom CSS code for theming/branding on the web interface.", "LabelCustomDeviceDisplayNameHelp": "Supply a custom display name or leave empty to use the name reported by the device.", "LabelCustomRating": "Custom rating", + "LabelcustomTagDelimiters": "Custom Tag Delimiter", "LabelcustomTagDelimitersHelp": "Characters to be treated as delimiters to separate tags.", "LabelDashboardTheme": "Server Dashboard theme", "LabelDate": "Date", @@ -626,6 +628,7 @@ "LabelDeathDate": "Death date", "LabelDefaultScreen": "Default screen", "LabelDeinterlaceMethod": "Deinterlacing method", + "LabelDelimiterWhitelist": "Delimiter Whitelist", "LabelDelimiterWhitelistHelp": "Items to be excluded from tag splitting. One item per line.", "LabelDeveloper": "Developer", "LabelDisableCustomCss": "Disable custom CSS code for theming/branding provided from the server.", @@ -1303,6 +1306,7 @@ "PreferEmbeddedExtrasTitlesOverFileNamesHelp": "Extras often have the same embedded name as the parent, check this to use embedded titles for them anyway.", "PreferEmbeddedTitlesOverFileNames": "Prefer embedded titles over filenames", "PreferEmbeddedTitlesOverFileNamesHelp": "Determine the display title to use when no internet metadata or local metadata is available.", + "PreferNonstandardArtistsTag": "Prefer ARTISTS tag if available", "PreferNonstandardArtistsTagHelp": "Use the non-standard ARTISTS tag instead of ARTIST tag when available.", "AllowEmbeddedSubtitles": "Disable different types of embedded subtitles", "AllowEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers. Requires a full library refresh.", @@ -1532,6 +1536,7 @@ "UnsupportedPlayback": "Jellyfin cannot decrypt content protected by DRM but all content will be tried regardless, including protected titles. Some files may appear completely black due to encryption or other unsupported features, such as interactive titles.", "Up": "Up", "Upload": "Upload", + "UseCustomTagDelimiters": "Use custom tag delimiter", "UseCustomTagDelimitersHelp": "Split artist/genre tags with custom characters.", "UseDoubleRateDeinterlacing": "Double the frame rate when deinterlacing", "UseDoubleRateDeinterlacingHelp": "This setting uses the field rate when deinterlacing, often referred to as bob deinterlacing, which doubles the frame rate of the video to provide full motion like what you would see when viewing interlaced video on a TV.", From 31b6a43a852d804aaec96450b66d9e3c9794279e Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 4 Aug 2024 15:31:52 +0800 Subject: [PATCH 3/4] Fix filtering for setter and getter --- src/components/libraryoptionseditor/libraryoptionseditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index 73784097d9b..9413a601d6d 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -572,7 +572,7 @@ export function getLibraryOptions(parent) { return elem.getAttribute('data-lang'); }); options.CustomTagDelimiters = parent.querySelector('#customTagDelimitersInput').value.split(''); - options.DelimiterWhitelist = parent.querySelector('#tagDelimiterWhitelist').value.split('\n'); + options.DelimiterWhitelist = parent.querySelector('#tagDelimiterWhitelist').value.split('\n').filter(item => item.trim()); setSubtitleFetchersIntoOptions(parent, options); setMetadataFetchersIntoOptions(parent, options); setImageFetchersIntoOptions(parent, options); @@ -628,7 +628,7 @@ export function setLibraryOptions(parent, options) { elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang')); }); parent.querySelector('#customTagDelimitersInput').value = options.CustomTagDelimiters.join(''); - parent.querySelector('#tagDelimiterWhitelist').value = options.DelimiterWhitelist.join('\n').filter(item => item.trim()); + parent.querySelector('#tagDelimiterWhitelist').value = options.DelimiterWhitelist.filter(item => item.trim()).join('\n'); renderMetadataReaders(parent, getOrderedPlugins(parent.availableOptions.MetadataReaders, options.LocalMetadataReaderOrder || [])); renderMetadataFetchers(parent, parent.availableOptions, options); renderImageFetchers(parent, parent.availableOptions, options); From 9fb0c4473c6a346ae8bb2add6a1a82100654474d Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 4 Aug 2024 19:07:03 +0800 Subject: [PATCH 4/4] PascalCase in string key for uniformity Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com> --- .../libraryoptionseditor/libraryoptionseditor.template.html | 4 ++-- src/strings/en-us.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index e1793fdd1dd..f05fd6a451f 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -223,8 +223,8 @@

${LabelAudioTagSettings}

${UseCustomTagDelimitersHelp}
- -
${LabelcustomTagDelimitersHelp}
+ +
${LabelCustomTagDelimitersHelp}
diff --git a/src/strings/en-us.json b/src/strings/en-us.json index cf68b5591b6..a0108954e33 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -616,8 +616,8 @@ "LabelCustomCssHelp": "Apply your custom CSS code for theming/branding on the web interface.", "LabelCustomDeviceDisplayNameHelp": "Supply a custom display name or leave empty to use the name reported by the device.", "LabelCustomRating": "Custom rating", - "LabelcustomTagDelimiters": "Custom Tag Delimiter", - "LabelcustomTagDelimitersHelp": "Characters to be treated as delimiters to separate tags.", + "LabelCustomTagDelimiters": "Custom Tag Delimiter", + "LabelCustomTagDelimitersHelp": "Characters to be treated as delimiters to separate tags.", "LabelDashboardTheme": "Server Dashboard theme", "LabelDate": "Date", "LabelDateAdded": "Date added",