diff options
| author | Matthew Jones <matthewbtjones2000@gmail.com> | 2022-01-26 16:09:05 +0000 |
|---|---|---|
| committer | Matthew Jones <matthewbtjones2000@gmail.com> | 2022-01-26 16:09:05 +0000 |
| commit | 91d143d6ee25a309efadf1575a1efc432adb81cf (patch) | |
| tree | 652680381b5ffb2c65646390d947e371ca76849d | |
| parent | 61d8d40a4a2bcdfd72d810f1c22247dfc53d6d53 (diff) | |
Changed boolean options to enums
| -rw-r--r-- | MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Model/Configuration/LibraryOptions.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs | 4 |
3 files changed, 34 insertions, 5 deletions
diff --git a/MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs b/MediaBrowser.Model/Configuration/EmbeddedSubtitleOptions.cs new file mode 100644 index 000000000..948027603 --- /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, + + /// <summary> + /// Allow only embedded subs that are text based. + /// </summary> + AllowText, + + /// <summary> + /// Allow only embedded subs that are image based. + /// </summary> + AllowImage, + + /// <summary> + /// Disable all embedded subs. + /// </summary> + AllowNone, + } + +} diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index efa63b5e1..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,9 +85,7 @@ namespace MediaBrowser.Model.Configuration public bool AutomaticallyAddToCollection { get; set; } - public bool DisableEmbeddedTextSubtitles { get; set; } - - public bool DisableEmbeddedImageSubtitles { get; set; } + public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; } public TypeOptions[] TypeOptions { get; set; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index c1145f8a2..71cdc5bff 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -229,13 +229,13 @@ namespace MediaBrowser.Providers.MediaInfo video.Video3DFormat ??= mediaInfo.Video3DFormat; } - if (libraryOptions.DisableEmbeddedImageSubtitles) + 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.DisableEmbeddedTextSubtitles) + 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); |
