From fad290483e079abf1dc98ac0e9b10bb2e18358c3 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Sun, 26 Dec 2021 19:11:07 +0000 Subject: [PATCH 1/5] Add DisableEmbeddedSubtitles support Adds the option to disable embedded subs for libraries --- CONTRIBUTORS.md | 1 + .../libraryoptionseditor/libraryoptionseditor.js | 8 ++++++++ .../libraryoptionseditor.template.html | 7 +++++++ src/strings/en-gb.json | 2 ++ src/strings/en-us.json | 2 ++ 5 files changed, 20 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6811962cc7..34e077c433 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -50,6 +50,7 @@ - [Keegan Dahm](https://github.com/keegandahm) - [GodTamIt](https://github.com/GodTamIt) - [MinecraftPlaye](https://github.com/MinecraftPlaye) + - [Matthew Jones](https://github.com/matthew-jones-uk) # Emby Contributors diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index 252b8b6dfc..8418621095 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -411,6 +411,12 @@ import template from './libraryoptionseditor.template.html'; parent.querySelector('.chkEnableEmbeddedEpisodeInfosContainer').classList.add('hide'); } + if (contentType !== 'tvshows' || contentType !== 'movies' || contentType !== 'musicvideos' || contentType !== 'mixed') { + parent.querySelector('.chkDisableEmbeddedSubtitlesContainer').classList.remove('hide'); + } else { + parent.querySelector('.chkDisableEmbeddedSubtitlesContainer').classList.add('hide'); + } + parent.querySelector('.chkAutomaticallyAddToCollectionContainer').classList.toggle('hide', contentType !== 'movies'); return populateMetadataSettings(parent, contentType); @@ -509,6 +515,7 @@ import template from './libraryoptionseditor.template.html'; AutomaticRefreshIntervalDays: parseInt(parent.querySelector('#selectAutoRefreshInterval').value), EnableEmbeddedTitles: parent.querySelector('#chkEnableEmbeddedTitles').checked, EnableEmbeddedEpisodeInfos: parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked, + DisableEmbeddedSubtitles: parent.querySelector('#chkDisableEmbeddedSubtitles').checked, SkipSubtitlesIfEmbeddedSubtitlesPresent: parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked, SkipSubtitlesIfAudioTrackMatches: parent.querySelector('#chkSkipIfAudioTrackPresent').checked, SaveSubtitlesWithMedia: parent.querySelector('#chkSaveSubtitlesLocally').checked, @@ -561,6 +568,7 @@ import template from './libraryoptionseditor.template.html'; parent.querySelector('.chkAutomaticallyGroupSeries').checked = options.EnableAutomaticSeriesGrouping; parent.querySelector('#chkEnableEmbeddedTitles').checked = options.EnableEmbeddedTitles; parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked = options.EnableEmbeddedEpisodeInfos; + parent.querySelector('#chkDisableEmbeddedSubtitles').checked = options.DisableEmbeddedSubtitles; parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent; parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia; parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches; diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.template.html b/src/components/libraryoptionseditor/libraryoptionseditor.template.html index bb94e0ee20..57cca6302c 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/src/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -30,6 +30,13 @@
${PreferEmbeddedEpisodeInfosOverFileNamesHelp}
+
+ +
${DisableEmbeddedSubtitlesHelp}
+
${PreferEmbeddedEpisodeInfosOverFileNamesHelp}
-
- -
${DisableEmbeddedSubtitlesHelp}
+
+ +
${AllowEmbeddedSubtitlesHelp}
diff --git a/src/strings/en-gb.json b/src/strings/en-gb.json index 22c2326267..a1a29061be 100644 --- a/src/strings/en-gb.json +++ b/src/strings/en-gb.json @@ -1266,8 +1266,12 @@ "Season": "Series", "PreferEmbeddedEpisodeInfosOverFileNames": "Prefer embedded episode information over filenames", "PreferEmbeddedEpisodeInfosOverFileNamesHelp": "Use the episode information from the embedded metadata if available.", - "DisableEmbeddedSubtitles": "Disable embedded subtitles", - "DisableEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers.", + "AllowEmbeddedSubtitles": "Disable different types of embedded subtitles", + "AllowEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers. Requires a full library refresh.", + "AllowEmbeddedSubtitlesAllowAllOption": "Allow All", + "AllowEmbeddedSubtitlesAllowNoneOption": "Allow None", + "AllowEmbeddedSubtitlesAllowImageOption": "Allow Image", + "AllowEmbeddedSubtitlesAllowTextOption": "Allow Text", "Person": "Person", "Movie": "Film", "LabelLibraryPageSizeHelp": "Set the amount of items to show on a library page. Set to 0 in order to disable paging.", diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 0685d09df5..725af66861 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1288,8 +1288,12 @@ "PreferEmbeddedEpisodeInfosOverFileNamesHelp": "Use the episode information from the embedded metadata if available.", "PreferEmbeddedTitlesOverFileNames": "Prefer embedded titles over filenames", "PreferEmbeddedTitlesOverFileNamesHelp": "Determine the display title to use when no internet metadata or local metadata is available.", - "DisableEmbeddedSubtitles": "Disable embedded subtitles", - "DisableEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers.", + "AllowEmbeddedSubtitles": "Disable different types of embedded subtitles", + "AllowEmbeddedSubtitlesHelp": "Disable subtitles that are packaged within media containers. Requires a full library refresh.", + "AllowEmbeddedSubtitlesAllowAllOption": "Allow All", + "AllowEmbeddedSubtitlesAllowNoneOption": "Allow None", + "AllowEmbeddedSubtitlesAllowImageOption": "Allow Image", + "AllowEmbeddedSubtitlesAllowTextOption": "Allow Text", "Premiere": "Premiere", "Premieres": "Premieres", "Preview": "Preview", From 4dbdd84140b1b6c18825752d6d1ac70e85580b46 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Sat, 12 Feb 2022 20:10:12 +0000 Subject: [PATCH 5/5] Fix eslint errors --- 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 308e2eb6b7..b8950ebed0 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -416,7 +416,7 @@ import template from './libraryoptionseditor.template.html'; } else { parent.querySelector('.fldAllowEmbeddedSubtitlesContainer').classList.add('hide'); } - + parent.querySelector('.chkAutomaticallyAddToCollectionContainer').classList.toggle('hide', contentType !== 'movies' && contentType !== 'mixed'); return populateMetadataSettings(parent, contentType); @@ -568,7 +568,7 @@ import template from './libraryoptionseditor.template.html'; parent.querySelector('.chkAutomaticallyGroupSeries').checked = options.EnableAutomaticSeriesGrouping; parent.querySelector('#chkEnableEmbeddedTitles').checked = options.EnableEmbeddedTitles; parent.querySelector('#chkEnableEmbeddedEpisodeInfos').value = options.EnableEmbeddedEpisodeInfos; - parent.querySelector("#selectAllowEmbeddedSubtitles").value = options.AllowEmbeddedSubtitles; + parent.querySelector('#selectAllowEmbeddedSubtitles').value = options.AllowEmbeddedSubtitles; parent.querySelector('#chkSkipIfGraphicalSubsPresent').checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent; parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia; parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;