Skip to content

Commit

Permalink
Add non-standard multi-value audio tag support
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattu committed Aug 4, 2024
1 parent d770e40 commit 524ede4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/libraryoptionseditor/libraryoptionseditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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 => {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,29 @@ <h2>${Lyrics}</h2>
<div class="fieldDescription checkboxFieldDescription">${SaveLyricsIntoMediaFoldersHelp}</div>
</div>
</div>

<div class="audioTagSettingsSection hide">
<h2>Audio Tag settings</h2>
<div class="checkboxContainer checkboxContainer-withDescription advanced">
<label>
<input type="checkbox" is="emby-checkbox" id="chkPreferNonstandardArtistsTag" />
<span>Prefer ARTISTS tag if available</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${PreferNonstandardArtistsTagHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription advanced">
<label>
<input type="checkbox" is="emby-checkbox" id="chkUseCustomTagDelimiters" />
<span>Use custom tag splitter</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${UseCustomTagDelimitersHelp}</div>
</div>
<div class="inputContainer">
<input type="text" is="emby-input" id="customTagDelimitersInput" label="Custom Tag Delimiter" value="/|;\"/>
<div class="fieldDescription">${LabelcustomTagDelimitersHelp}</div>
</div>
<div class="inputContainer">
<textarea is="emby-textarea" id="tagDelimiterWhitelist" label="Delimiter Whitelist" class="textarea-mono" style="resize: none;min-height:2.5em"></textarea>
<div class="fieldDescription">${LabelDelimiterWhitelistHelp}</div>
</div>
</div>
4 changes: 4 additions & 0 deletions src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 524ede4

Please sign in to comment.