Changed boolean options to enums

This commit is contained in:
Matthew Jones 2022-01-26 16:09:05 +00:00
parent 61d8d40a4a
commit 91d143d6ee
3 changed files with 34 additions and 5 deletions

View File

@ -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,
}
}

View File

@ -15,6 +15,7 @@ namespace MediaBrowser.Model.Configuration
SkipSubtitlesIfAudioTrackMatches = true; SkipSubtitlesIfAudioTrackMatches = true;
RequirePerfectSubtitleMatch = true; RequirePerfectSubtitleMatch = true;
AllowEmbeddedSubtitles = EmbeddedSubtitleOptions.AllowAll;
AutomaticallyAddToCollection = true; AutomaticallyAddToCollection = true;
EnablePhotos = true; EnablePhotos = true;
@ -84,9 +85,7 @@ namespace MediaBrowser.Model.Configuration
public bool AutomaticallyAddToCollection { get; set; } public bool AutomaticallyAddToCollection { get; set; }
public bool DisableEmbeddedTextSubtitles { get; set; } public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; }
public bool DisableEmbeddedImageSubtitles { get; set; }
public TypeOptions[] TypeOptions { get; set; } public TypeOptions[] TypeOptions { get; set; }

View File

@ -229,13 +229,13 @@ namespace MediaBrowser.Providers.MediaInfo
video.Video3DFormat ??= mediaInfo.Video3DFormat; 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); _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); 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); _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); mediaStreams.RemoveAll(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal && i.IsTextSubtitleStream);