aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-02-11 13:20:37 -0700
committerGitHub <noreply@github.com>2022-02-11 13:20:37 -0700
commit603b6fe173c88c06229fc12ef29aec0896b9f004 (patch)
tree59d6b5b1ff85a3496d3f03ad811b6fc5498f9b82
parentbb7916767cd6ce6e609e4e33e7ff15d744cda2eb (diff)
parentb7cab46b4ac3da712c63e34bdac3559bdd53ad98 (diff)
Merge pull request #7054 from matthew-jones-uk/disable-embedded-subs
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs30
-rw-r--r--MediaBrowser.Model/Configuration/LibraryOptions.cs3
-rw-r--r--MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs12
4 files changed, 46 insertions, 0 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index d52e13324..f70b713de 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -217,3 +217,4 @@
- [olsh](https://github.com/olsh)
- [lbenini](https://github.com/lbenini)
- [gnuyent](https://github.com/gnuyent)
+ - [Matthew Jones](https://github.com/matthew-jones-uk)
diff --git a/MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs b/MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs
new file mode 100644
index 000000000..42f07dbff
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs
@@ -0,0 +1,30 @@
+namespace MediaBrowser.Model.Configuration
+{
+ /// <summary>
+ /// An enum representing the options to disable embedded subs.
+ /// </summary>
+ public enum EmbeddedSubtitleOptions
+ {
+
+ /// <summary>
+ /// Allow all embedded subs.
+ /// </summary>
+ AllowAll = 0,
+
+ /// <summary>
+ /// Allow only embedded subs that are text based.
+ /// </summary>
+ AllowText = 1,
+
+ /// <summary>
+ /// Allow only embedded subs that are image based.
+ /// </summary>
+ AllowImage = 2,
+
+ /// <summary>
+ /// Disable all embedded subs.
+ /// </summary>
+ AllowNone = 3,
+ }
+
+}
diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs
index d3ce6aa7f..ad3bce86e 100644
--- a/MediaBrowser.Model/Configuration/LibraryOptions.cs
+++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs
@@ -15,6 +15,7 @@ namespace MediaBrowser.Model.Configuration
SkipSubtitlesIfAudioTrackMatches = true;
RequirePerfectSubtitleMatch = true;
+ AllowEmbeddedSubtitles = EmbeddedSubtitleOptions.AllowAll;
AutomaticallyAddToCollection = true;
EnablePhotos = true;
@@ -84,6 +85,8 @@ namespace MediaBrowser.Model.Configuration
public bool AutomaticallyAddToCollection { get; set; }
+ public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; }
+
public TypeOptions[] TypeOptions { get; set; }
public TypeOptions? GetTypeOptions(string type)
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
index a2fb2a3c9..d67e83ab4 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
@@ -229,6 +229,18 @@ namespace MediaBrowser.Providers.MediaInfo
video.Video3DFormat ??= mediaInfo.Video3DFormat;
}
+ if (libraryOptions.AllowEmbeddedSubtitles == EmbeddedSubtitleOptions.AllowText || libraryOptions.AllowEmbeddedSubtitles == EmbeddedSubtitleOptions.AllowNone)
+ {
+ _logger.LogDebug("Disabling embedded image subtitles for {Path} due to DisableEmbeddedImageSubtitles setting", video.Path);
+ mediaStreams.RemoveAll(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal && !i.IsTextSubtitleStream);
+ }
+
+ if (libraryOptions.AllowEmbeddedSubtitles == EmbeddedSubtitleOptions.AllowImage || libraryOptions.AllowEmbeddedSubtitles == EmbeddedSubtitleOptions.AllowNone)
+ {
+ _logger.LogDebug("Disabling embedded text subtitles for {Path} due to DisableEmbeddedTextSubtitles setting", video.Path);
+ mediaStreams.RemoveAll(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal && i.IsTextSubtitleStream);
+ }
+
var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
video.Height = videoStream?.Height ?? 0;