diff options
| author | WWWesten <4700006+WWWesten@users.noreply.github.com> | 2021-11-01 23:43:29 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-01 23:43:29 +0500 |
| commit | 0a14279e2a21bcb9654a06a2d49e1e4f0cc5329c (patch) | |
| tree | e1b1bd603b011ca98e5793e356326bf4a35a7050 /MediaBrowser.Model/Configuration | |
| parent | f2817fef743eeb75a00782ceea363b2d3e7dc9f2 (diff) | |
| parent | 76eeb8f655424d295e73ced8349c6fefee6ddb12 (diff) | |
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'MediaBrowser.Model/Configuration')
21 files changed, 978 insertions, 692 deletions
diff --git a/MediaBrowser.Model/Configuration/AccessSchedule.cs b/MediaBrowser.Model/Configuration/AccessSchedule.cs deleted file mode 100644 index d34e27383..000000000 --- a/MediaBrowser.Model/Configuration/AccessSchedule.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public class AccessSchedule - { - /// <summary> - /// Gets or sets the day of week. - /// </summary> - /// <value>The day of week.</value> - public DynamicDayOfWeek DayOfWeek { get; set; } - /// <summary> - /// Gets or sets the start hour. - /// </summary> - /// <value>The start hour.</value> - public double StartHour { get; set; } - /// <summary> - /// Gets or sets the end hour. - /// </summary> - /// <value>The end hour.</value> - public double EndHour { get; set; } - } -} diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs index 6a1a0f090..57759a7d3 100644 --- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs +++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs @@ -1,3 +1,6 @@ +using System; +using System.Xml.Serialization; + namespace MediaBrowser.Model.Configuration { /// <summary> @@ -8,7 +11,15 @@ namespace MediaBrowser.Model.Configuration public class BaseApplicationConfiguration { /// <summary> - /// The number of days we should retain log files + /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class. + /// </summary> + public BaseApplicationConfiguration() + { + LogFileRetentionDays = 3; + } + + /// <summary> + /// Gets or sets the number of days we should retain log files. /// </summary> /// <value>The log file retention days.</value> public int LogFileRetentionDays { get; set; } @@ -23,14 +34,30 @@ namespace MediaBrowser.Model.Configuration /// Gets or sets the cache path. /// </summary> /// <value>The cache path.</value> - public string CachePath { get; set; } + public string? CachePath { get; set; } /// <summary> - /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class. + /// Gets or sets the last known version that was ran using the configuration. /// </summary> - public BaseApplicationConfiguration() + /// <value>The version from previous run.</value> + [XmlIgnore] + public Version? PreviousVersion { get; set; } + + /// <summary> + /// Gets or sets the stringified PreviousVersion to be stored/loaded, + /// because System.Version itself isn't xml-serializable. + /// </summary> + /// <value>String value of PreviousVersion.</value> + public string? PreviousVersionStr { - LogFileRetentionDays = 3; + get => PreviousVersion?.ToString(); + set + { + if (Version.TryParse(value, out var version)) + { + PreviousVersion = version; + } + } } } } diff --git a/MediaBrowser.Model/Configuration/DynamicDayOfWeek.cs b/MediaBrowser.Model/Configuration/DynamicDayOfWeek.cs deleted file mode 100644 index 73dda5a77..000000000 --- a/MediaBrowser.Model/Configuration/DynamicDayOfWeek.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public enum DynamicDayOfWeek - { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - Everyday = 7, - Weekday = 8, - Weekend = 9 - } -} diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index 8584bd3dd..365bbeef6 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -1,35 +1,115 @@ +#nullable disable +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { public class EncodingOptions { + public EncodingOptions() + { + EnableFallbackFont = false; + DownMixAudioBoost = 2; + MaxMuxingQueueSize = 2048; + EnableThrottling = false; + ThrottleDelaySeconds = 180; + EncodingThreadCount = -1; + // This is a DRM device that is almost guaranteed to be there on every intel platform, + // plus it's the default one in ffmpeg if you don't specify anything + VaapiDevice = "/dev/dri/renderD128"; + // This is the OpenCL device that is used for tonemapping. + // The left side of the dot is the platform number, and the right side is the device number on the platform. + OpenclDevice = "0.0"; + EnableTonemapping = false; + EnableVppTonemapping = false; + TonemappingAlgorithm = "hable"; + TonemappingRange = "auto"; + TonemappingDesat = 0; + TonemappingThreshold = 0.8; + TonemappingPeak = 100; + TonemappingParam = 0; + H264Crf = 23; + H265Crf = 28; + DeinterlaceDoubleRate = false; + DeinterlaceMethod = "yadif"; + EnableDecodingColorDepth10Hevc = true; + EnableDecodingColorDepth10Vp9 = true; + EnableEnhancedNvdecDecoder = true; + EnableHardwareEncoding = true; + AllowHevcEncoding = false; + EnableSubtitleExtraction = true; + HardwareDecodingCodecs = new string[] { "h264", "vc1" }; + } + public int EncodingThreadCount { get; set; } + public string TranscodingTempPath { get; set; } + + public string FallbackFontPath { get; set; } + + public bool EnableFallbackFont { get; set; } + public double DownMixAudioBoost { get; set; } + + public int MaxMuxingQueueSize { get; set; } + public bool EnableThrottling { get; set; } + public int ThrottleDelaySeconds { get; set; } + public string HardwareAccelerationType { get; set; } + + /// <summary> + /// Gets or sets the FFmpeg path as set by the user via the UI. + /// </summary> public string EncoderAppPath { get; set; } + + /// <summary> + /// Gets or sets the current FFmpeg path being used by the system and displayed on the transcode page. + /// </summary> + public string EncoderAppPathDisplay { get; set; } + public string VaapiDevice { get; set; } + + public string OpenclDevice { get; set; } + + public bool EnableTonemapping { get; set; } + + public bool EnableVppTonemapping { get; set; } + + public string TonemappingAlgorithm { get; set; } + + public string TonemappingRange { get; set; } + + public double TonemappingDesat { get; set; } + + public double TonemappingThreshold { get; set; } + + public double TonemappingPeak { get; set; } + + public double TonemappingParam { get; set; } + public int H264Crf { get; set; } - public string H264Preset { get; set; } + + public int H265Crf { get; set; } + + public string EncoderPreset { get; set; } + + public bool DeinterlaceDoubleRate { get; set; } + public string DeinterlaceMethod { get; set; } + + public bool EnableDecodingColorDepth10Hevc { get; set; } + + public bool EnableDecodingColorDepth10Vp9 { get; set; } + + public bool EnableEnhancedNvdecDecoder { get; set; } + public bool EnableHardwareEncoding { get; set; } + + public bool AllowHevcEncoding { get; set; } + public bool EnableSubtitleExtraction { get; set; } public string[] HardwareDecodingCodecs { get; set; } - - public EncodingOptions() - { - DownMixAudioBoost = 2; - EnableThrottling = true; - ThrottleDelaySeconds = 180; - EncodingThreadCount = -1; - // This is a DRM device that is almost guaranteed to be there on every intel platform, plus it's the default one in ffmpeg if you don't specify anything - VaapiDevice = "/dev/dri/renderD128"; - H264Crf = 23; - EnableHardwareEncoding = true; - EnableSubtitleExtraction = true; - HardwareDecodingCodecs = new string[] { "h264", "vc1" }; - } } } diff --git a/MediaBrowser.Model/Configuration/FanartOptions.cs b/MediaBrowser.Model/Configuration/FanartOptions.cs deleted file mode 100644 index 9c8be39be..000000000 --- a/MediaBrowser.Model/Configuration/FanartOptions.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public class FanartOptions - { - /// <summary> - /// Gets or sets the user API key. - /// </summary> - /// <value>The user API key.</value> - public string UserApiKey { get; set; } - } -} diff --git a/MediaBrowser.Model/Configuration/ImageOption.cs b/MediaBrowser.Model/Configuration/ImageOption.cs index 3b985bb1b..0af7b7e14 100644 --- a/MediaBrowser.Model/Configuration/ImageOption.cs +++ b/MediaBrowser.Model/Configuration/ImageOption.cs @@ -1,14 +1,22 @@ +#pragma warning disable CS1591 + using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Configuration { public class ImageOption { + public ImageOption() + { + Limit = 1; + } + /// <summary> /// Gets or sets the type. /// </summary> /// <value>The type.</value> public ImageType Type { get; set; } + /// <summary> /// Gets or sets the limit. /// </summary> @@ -20,10 +28,5 @@ namespace MediaBrowser.Model.Configuration /// </summary> /// <value>The minimum width.</value> public int MinWidth { get; set; } - - public ImageOption() - { - Limit = 1; - } } } diff --git a/MediaBrowser.Model/Configuration/ImageSavingConvention.cs b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs index 7206fa5fc..485a4d2f8 100644 --- a/MediaBrowser.Model/Configuration/ImageSavingConvention.cs +++ b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { public enum ImageSavingConvention diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index ba33bee87..aae5359b1 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -1,67 +1,11 @@ +#pragma warning disable CS1591 + using System; -using System.Collections.Generic; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Configuration { public class LibraryOptions { - public bool EnablePhotos { get; set; } - public bool EnableRealtimeMonitor { get; set; } - public bool EnableChapterImageExtraction { get; set; } - public bool ExtractChapterImagesDuringLibraryScan { get; set; } - public bool DownloadImagesInAdvance { get; set; } - public MediaPathInfo[] PathInfos { get; set; } - - public bool SaveLocalMetadata { get; set; } - public bool EnableInternetProviders { get; set; } - public bool ImportMissingEpisodes { get; set; } - public bool EnableAutomaticSeriesGrouping { get; set; } - public bool EnableEmbeddedTitles { get; set; } - - public int AutomaticRefreshIntervalDays { get; set; } - - /// <summary> - /// Gets or sets the preferred metadata language. - /// </summary> - /// <value>The preferred metadata language.</value> - public string PreferredMetadataLanguage { get; set; } - - /// <summary> - /// Gets or sets the metadata country code. - /// </summary> - /// <value>The metadata country code.</value> - public string MetadataCountryCode { get; set; } - - public string SeasonZeroDisplayName { get; set; } - public string[] MetadataSavers { get; set; } - public string[] DisabledLocalMetadataReaders { get; set; } - public string[] LocalMetadataReaderOrder { get; set; } - - public string[] DisabledSubtitleFetchers { get; set; } - public string[] SubtitleFetcherOrder { get; set; } - - public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; } - public bool SkipSubtitlesIfAudioTrackMatches { get; set; } - public string[] SubtitleDownloadLanguages { get; set; } - public bool RequirePerfectSubtitleMatch { get; set; } - public bool SaveSubtitlesWithMedia { get; set; } - - public TypeOptions[] TypeOptions { get; set; } - - public TypeOptions GetTypeOptions(string type) - { - foreach (var options in TypeOptions) - { - if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase)) - { - return options; - } - } - - return null; - } - public LibraryOptions() { TypeOptions = Array.Empty<TypeOptions>(); @@ -80,363 +24,76 @@ namespace MediaBrowser.Model.Configuration EnableAutomaticSeriesGrouping = true; SeasonZeroDisplayName = "Specials"; } - } - - public class MediaPathInfo - { - public string Path { get; set; } - public string NetworkPath { get; set; } - } - - public class TypeOptions - { - public string Type { get; set; } - public string[] MetadataFetchers { get; set; } - public string[] MetadataFetcherOrder { get; set; } - - public string[] ImageFetchers { get; set; } - public string[] ImageFetcherOrder { get; set; } - public ImageOption[] ImageOptions { get; set; } - - public ImageOption GetImageOptions(ImageType type) - { - foreach (var i in ImageOptions) - { - if (i.Type == type) - { - return i; - } - } - - if (DefaultImageOptions.TryGetValue(Type, out ImageOption[] options)) - { - foreach (var i in options) - { - if (i.Type == type) - { - return i; - } - } - } - - return DefaultInstance; - } - - public int GetLimit(ImageType type) - { - return GetImageOptions(type).Limit; - } - - public int GetMinWidth(ImageType type) - { - return GetImageOptions(type).MinWidth; - } - - public bool IsEnabled(ImageType type) - { - return GetLimit(type) > 0; - } - - public TypeOptions() - { - MetadataFetchers = Array.Empty<string>(); - MetadataFetcherOrder = Array.Empty<string>(); - ImageFetchers = Array.Empty<string>(); - ImageFetcherOrder = Array.Empty<string>(); - ImageOptions = Array.Empty<ImageOption>(); - } - - public static Dictionary<string, ImageOption[]> DefaultImageOptions = new Dictionary<string, ImageOption[]> - { - { - "Movie", new [] - { - new ImageOption - { - Limit = 1, - MinWidth = 1280, - Type = ImageType.Backdrop - }, - - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Art - }, - - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Disc - }, - - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - }, - - new ImageOption - { - Limit = 0, - Type = ImageType.Banner - }, - new ImageOption - { - Limit = 1, - Type = ImageType.Thumb - }, + public bool EnablePhotos { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Logo - } - } - }, - { - "MusicVideo", new [] - { - new ImageOption - { - Limit = 1, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + public bool EnableRealtimeMonitor { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Art - }, + public bool EnableChapterImageExtraction { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Disc - }, + public bool ExtractChapterImagesDuringLibraryScan { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - }, + public MediaPathInfo[] PathInfos { get; set; } - new ImageOption - { - Limit = 0, - Type = ImageType.Banner - }, + public bool SaveLocalMetadata { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Thumb - }, + public bool EnableInternetProviders { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Logo - } - } - }, - { - "Series", new [] - { - new ImageOption - { - Limit = 1, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + public bool EnableAutomaticSeriesGrouping { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Art - }, + public bool EnableEmbeddedTitles { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - }, + public bool EnableEmbeddedEpisodeInfos { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Banner - }, + public int AutomaticRefreshIntervalDays { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Thumb - }, + /// <summary> + /// Gets or sets the preferred metadata language. + /// </summary> + /// <value>The preferred metadata language.</value> + public string? PreferredMetadataLanguage { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Logo - } - } - }, - { - "MusicAlbum", new [] - { - new ImageOption - { - Limit = 0, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + /// <summary> + /// Gets or sets the metadata country code. + /// </summary> + /// <value>The metadata country code.</value> + public string? MetadataCountryCode { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Disc - } - } - }, - { - "MusicArtist", new [] - { - new ImageOption - { - Limit = 1, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + public string SeasonZeroDisplayName { get; set; } - // Don't download this by default - // They do look great, but most artists won't have them, which means a banner view isn't really possible - new ImageOption - { - Limit = 0, - Type = ImageType.Banner - }, + public string[]? MetadataSavers { get; set; } - // Don't download this by default - // Generally not used - new ImageOption - { - Limit = 0, - Type = ImageType.Art - }, + public string[] DisabledLocalMetadataReaders { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Logo - } - } - }, - { - "BoxSet", new [] - { - new ImageOption - { - Limit = 1, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + public string[]? LocalMetadataReaderOrder { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - }, + public string[] DisabledSubtitleFetchers { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Thumb - }, + public string[] SubtitleFetcherOrder { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Logo - }, + public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Art - }, + public bool SkipSubtitlesIfAudioTrackMatches { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Disc - }, + public string[]? SubtitleDownloadLanguages { get; set; } - // Don't download this by default as it's rarely used. - new ImageOption - { - Limit = 0, - Type = ImageType.Banner - } - } - }, - { - "Season", new [] - { - new ImageOption - { - Limit = 0, - MinWidth = 1280, - Type = ImageType.Backdrop - }, + public bool RequirePerfectSubtitleMatch { get; set; } - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - }, + public bool SaveSubtitlesWithMedia { get; set; } - new ImageOption - { - Limit = 0, - Type = ImageType.Banner - }, + public TypeOptions[] TypeOptions { get; set; } - new ImageOption - { - Limit = 0, - Type = ImageType.Thumb - } - } - }, + public TypeOptions? GetTypeOptions(string type) + { + foreach (var options in TypeOptions) { - "Episode", new [] + if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase)) { - new ImageOption - { - Limit = 0, - MinWidth = 1280, - Type = ImageType.Backdrop - }, - - new ImageOption - { - Limit = 1, - Type = ImageType.Primary - } + return options; } } - }; - public static ImageOption DefaultInstance = new ImageOption(); + return null; + } } } diff --git a/MediaBrowser.Model/Configuration/MediaPathInfo.cs b/MediaBrowser.Model/Configuration/MediaPathInfo.cs new file mode 100644 index 000000000..a7bc43590 --- /dev/null +++ b/MediaBrowser.Model/Configuration/MediaPathInfo.cs @@ -0,0 +1,22 @@ +#pragma warning disable CS1591 + +namespace MediaBrowser.Model.Configuration +{ + public class MediaPathInfo + { + public MediaPathInfo(string path) + { + Path = path; + } + + // Needed for xml serialization + public MediaPathInfo() + { + Path = string.Empty; + } + + public string Path { get; set; } + + public string? NetworkPath { get; set; } + } +} diff --git a/MediaBrowser.Model/Configuration/MetadataConfiguration.cs b/MediaBrowser.Model/Configuration/MetadataConfiguration.cs index 87e02d054..be044243d 100644 --- a/MediaBrowser.Model/Configuration/MetadataConfiguration.cs +++ b/MediaBrowser.Model/Configuration/MetadataConfiguration.cs @@ -1,12 +1,14 @@ +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { public class MetadataConfiguration { - public bool UseFileCreationTimeForDateAdded { get; set; } - public MetadataConfiguration() { UseFileCreationTimeForDateAdded = true; } + + public bool UseFileCreationTimeForDateAdded { get; set; } } } diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs index c095b8cdd..384a7997f 100644 --- a/MediaBrowser.Model/Configuration/MetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs @@ -1,3 +1,6 @@ +#nullable disable +#pragma warning disable CS1591, CA1819 + using System; namespace MediaBrowser.Model.Configuration @@ -7,25 +10,28 @@ namespace MediaBrowser.Model.Configuration /// </summary> public class MetadataOptions { + public MetadataOptions() + { + DisabledMetadataSavers = Array.Empty<string>(); + LocalMetadataReaderOrder = Array.Empty<string>(); + DisabledMetadataFetchers = Array.Empty<string>(); + MetadataFetcherOrder = Array.Empty<string>(); + DisabledImageFetchers = Array.Empty<string>(); + ImageFetcherOrder = Array.Empty<string>(); + } + public string ItemType { get; set; } public string[] DisabledMetadataSavers { get; set; } + public string[] LocalMetadataReaderOrder { get; set; } public string[] DisabledMetadataFetchers { get; set; } + public string[] MetadataFetcherOrder { get; set; } public string[] DisabledImageFetchers { get; set; } - public string[] ImageFetcherOrder { get; set; } - public MetadataOptions() - { - DisabledMetadataSavers = Array.Empty<string>(); - LocalMetadataReaderOrder = Array.Empty<string>(); - DisabledMetadataFetchers = Array.Empty<string>(); - MetadataFetcherOrder = Array.Empty<string>(); - DisabledImageFetchers = Array.Empty<string>(); - ImageFetcherOrder = Array.Empty<string>(); - } + public string[] ImageFetcherOrder { get; set; } } } diff --git a/MediaBrowser.Model/Configuration/MetadataPlugin.cs b/MediaBrowser.Model/Configuration/MetadataPlugin.cs index d6f863e55..db8cd1875 100644 --- a/MediaBrowser.Model/Configuration/MetadataPlugin.cs +++ b/MediaBrowser.Model/Configuration/MetadataPlugin.cs @@ -1,3 +1,6 @@ +#nullable disable +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { public class MetadataPlugin diff --git a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs index 0bd20f837..aa07d6623 100644 --- a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs +++ b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs @@ -1,3 +1,6 @@ +#nullable disable +#pragma warning disable CS1591 + using System; using MediaBrowser.Model.Entities; @@ -5,6 +8,12 @@ namespace MediaBrowser.Model.Configuration { public class MetadataPluginSummary { + public MetadataPluginSummary() + { + SupportedImageTypes = Array.Empty<ImageType>(); + Plugins = Array.Empty<MetadataPlugin>(); + } + /// <summary> /// Gets or sets the type of the item. /// </summary> @@ -22,11 +31,5 @@ namespace MediaBrowser.Model.Configuration /// </summary> /// <value>The supported image types.</value> public ImageType[] SupportedImageTypes { get; set; } - - public MetadataPluginSummary() - { - SupportedImageTypes = Array.Empty<ImageType>(); - Plugins = Array.Empty<MetadataPlugin>(); - } } } diff --git a/MediaBrowser.Model/Configuration/MetadataPluginType.cs b/MediaBrowser.Model/Configuration/MetadataPluginType.cs index 985107ac9..4c5e95266 100644 --- a/MediaBrowser.Model/Configuration/MetadataPluginType.cs +++ b/MediaBrowser.Model/Configuration/MetadataPluginType.cs @@ -1,7 +1,9 @@ +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { /// <summary> - /// Enum MetadataPluginType + /// Enum MetadataPluginType. /// </summary> public enum MetadataPluginType { diff --git a/MediaBrowser.Model/Configuration/PathSubstitution.cs b/MediaBrowser.Model/Configuration/PathSubstitution.cs new file mode 100644 index 000000000..2c9b5f005 --- /dev/null +++ b/MediaBrowser.Model/Configuration/PathSubstitution.cs @@ -0,0 +1,18 @@ +namespace MediaBrowser.Model.Configuration +{ + /// <summary> + /// Defines the <see cref="PathSubstitution" />. + /// </summary> + public class PathSubstitution + { + /// <summary> + /// Gets or sets the value to substitute. + /// </summary> + public string From { get; set; } = string.Empty; + + /// <summary> + /// Gets or sets the value to substitution with. + /// </summary> + public string To { get; set; } = string.Empty; + } +} diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index ed5800329..d1e999666 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -1,5 +1,10 @@ +#pragma warning disable CS1591 +#pragma warning disable CA1819 + using System; +using System.Collections.Generic; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Updates; namespace MediaBrowser.Model.Configuration { @@ -8,52 +13,210 @@ namespace MediaBrowser.Model.Configuration /// </summary> public class ServerConfiguration : BaseApplicationConfiguration { + /// <summary> + /// The default value for <see cref="HttpServerPortNumber"/>. + /// </summary> public const int DefaultHttpPort = 8096; + + /// <summary> + /// The default value for <see cref="PublicHttpsPort"/> and <see cref="HttpsPortNumber"/>. + /// </summary> public const int DefaultHttpsPort = 8920; + private string _baseUrl = string.Empty; + + /// <summary> + /// Initializes a new instance of the <see cref="ServerConfiguration" /> class. + /// </summary> + public ServerConfiguration() + { + MetadataOptions = new[] + { + new MetadataOptions() + { + ItemType = "Book" + }, + new MetadataOptions() + { + ItemType = "Movie" + }, + new MetadataOptions + { + ItemType = "MusicVideo", + DisabledMetadataFetchers = new[] { "The Open Movie Database" }, + DisabledImageFetchers = new[] { "The Open Movie Database" } + }, + new MetadataOptions + { + ItemType = "Series", + }, + new MetadataOptions + { + ItemType = "MusicAlbum", + DisabledMetadataFetchers = new[] { "TheAudioDB" } + }, + new MetadataOptions + { + ItemType = "MusicArtist", + DisabledMetadataFetchers = new[] { "TheAudioDB" } + }, + new MetadataOptions + { + ItemType = "BoxSet" + }, + new MetadataOptions + { + ItemType = "Season", + }, + new MetadataOptions + { + ItemType = "Episode", + } + }; + } + /// <summary> - /// Gets or sets a value indicating whether [enable u pn p]. + /// Gets or sets a value indicating whether to enable automatic port forwarding. /// </summary> - /// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value> - public bool EnableUPnP { get; set; } + public bool EnableUPnP { get; set; } = false; + + /// <summary> + /// Gets or sets a value indicating whether to enable prometheus metrics exporting. + /// </summary> + public bool EnableMetrics { get; set; } = false; /// <summary> /// Gets or sets the public mapped port. /// </summary> /// <value>The public mapped port.</value> - public int PublicPort { get; set; } + public int PublicPort { get; set; } = DefaultHttpPort; + + /// <summary> + /// Gets or sets a value indicating whether the http port should be mapped as part of UPnP automatic port forwarding. + /// </summary> + public bool UPnPCreateHttpPortMap { get; set; } = false; + + /// <summary> + /// Gets or sets client udp port range. + /// </summary> + public string UDPPortRange { get; set; } = string.Empty; + + /// <summary> + /// Gets or sets a value indicating whether IPV6 capability is enabled. + /// </summary> + public bool EnableIPV6 { get; set; } = false; + + /// <summary> + /// Gets or sets a value indicating whether IPV4 capability is enabled. + /// </summary> + public bool EnableIPV4 { get; set; } = true; + + /// <summary> + /// Gets or sets a value indicating whether detailed ssdp logs are sent to the console/log. + /// "Emby.Dlna": "Debug" must be set in logging.default.json for this property to work. + /// </summary> + public bool EnableSSDPTracing { get; set; } = false; + + /// <summary> + /// Gets or sets a value indicating whether an IP address is to be used to filter the detailed ssdp logs that are being sent to the console/log. + /// If the setting "Emby.Dlna": "Debug" msut be set in logging.default.json for this property to work. + /// </summary> + public string SSDPTracingFilter { get; set; } = string.Empty; + + /// <summary> + /// Gets or sets the number of times SSDP UDP messages are sent. + /// </summary> + public int UDPSendCount { get; set; } = 2; + + /// <summary> + /// Gets or sets the delay between each groups of SSDP messages (in ms). + /// </summary> + public int UDPSendDelay { get; set; } = 100; + + /// <summary> + /// Gets or sets a value indicating whether address names that match <see cref="VirtualInterfaceNames"/> should be Ignore for the purposes of binding. + /// </summary> + public bool IgnoreVirtualInterfaces { get; set; } = true; + + /// <summary> + /// Gets or sets a value indicating the interfaces that should be ignored. The list can be comma separated. <seealso cref="IgnoreVirtualInterfaces"/>. + /// </summary> + public string VirtualInterfaceNames { get; set; } = "vEthernet*"; + + /// <summary> + /// Gets or sets the time (in seconds) between the pings of SSDP gateway monitor. + /// </summary> + public int GatewayMonitorPeriod { get; set; } = 60; + + /// <summary> + /// Gets a value indicating whether multi-socket binding is available. + /// </summary> + public bool EnableMultiSocketBinding { get; } = true; + + /// <summary> + /// Gets or sets a value indicating whether all IPv6 interfaces should be treated as on the internal network. + /// Depending on the address range implemented ULA ranges might not be used. + /// </summary> + public bool TrustAllIP6Interfaces { get; set; } = false; + + /// <summary> + /// Gets or sets the ports that HDHomerun uses. + /// </summary> + public string HDHomerunPortRange { get; set; } = string.Empty; + + /// <summary> + /// Gets or sets PublishedServerUri to advertise for specific subnets. + /// </summary> + public string[] PublishedServerUriBySubnet { get; set; } = Array.Empty<string>(); + + /// <summary> + /// Gets or sets a value indicating whether Autodiscovery tracing is enabled. + /// </summary> + public bool AutoDiscoveryTracing { get; set; } = false; + + /// <summary> + /// Gets or sets a value indicating whether Autodiscovery is enabled. + /// </summary> + public bool AutoDiscovery { get; set; } = true; /// <summary> /// Gets or sets the public HTTPS port. /// </summary> /// <value>The public HTTPS port.</value> - public int PublicHttpsPort { get; set; } + public int PublicHttpsPort { get; set; } = DefaultHttpsPort; /// <summary> /// Gets or sets the HTTP server port number. /// </summary> /// <value>The HTTP server port number.</value> - public int HttpServerPortNumber { get; set; } + public int HttpServerPortNumber { get; set; } = DefaultHttpPort; /// <summary> /// Gets or sets the HTTPS server port number. /// </summary> /// <value>The HTTPS server port number.</value> - public int HttpsPortNumber { get; set; } + public int HttpsPortNumber { get; set; } = DefaultHttpsPort; /// <summary> - /// Gets or sets a value indicating whether [use HTTPS]. + /// Gets or sets a value indicating whether to use HTTPS. /// </summary> - /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value> - public bool EnableHttps { get; set; } - public bool EnableNormalizedItemByNameIds { get; set; } + /// <remarks> + /// In order for HTTPS to be used, in addition to setting this to true, valid values must also be + /// provided for <see cref="CertificatePath"/> and <see cref="CertificatePassword"/>. + /// </remarks> + public bool EnableHttps { get; set; } = false; + + public bool EnableNormalizedItemByNameIds { get; set; } = true; + + /// <summary> + /// Gets or sets the filesystem path of an X.509 certificate to use for SSL. + /// </summary> + public string CertificatePath { get; set; } = string.Empty; /// <summary> - /// Gets or sets the value pointing to the file system where the ssl certiifcate is located.. + /// Gets or sets the password required to access the X.509 certificate data in the file specified by <see cref="CertificatePath"/>. /// </summary> - /// <value>The value pointing to the file system where the ssl certiifcate is located..</value> - public string CertificatePath { get; set; } - public string CertificatePassword { get; set; } + public string CertificatePassword { get; set; } = string.Empty; /// <summary> /// Gets or sets a value indicating whether this instance is port authorized. @@ -61,94 +224,106 @@ namespace MediaBrowser.Model.Configuration /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value> public bool IsPortAuthorized { get; set; } - public bool AutoRunWebApp { get; set; } - public bool EnableRemoteAccess { get; set; } - public bool CameraUploadUpgraded { get; set; } - public bool CollectionsUpgraded { get; set; } + /// <summary> + /// Gets or sets a value indicating whether quick connect is available for use on this server. + /// </summary> + public bool QuickConnectAvailable { get; set; } = false; + + /// <summary> + /// Gets or sets a value indicating whether access outside of the LAN is permitted. + /// </summary> + public bool EnableRemoteAccess { get; set; } = true; /// <summary> /// Gets or sets a value indicating whether [enable case sensitive item ids]. /// </summary> /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value> - public bool EnableCaseSensitiveItemIds { get; set; } + public bool EnableCaseSensitiveItemIds { get; set; } = true; - public bool DisableLiveTvChannelUserDataName { get; set; } + public bool DisableLiveTvChannelUserDataName { get; set; } = true; /// <summary> /// Gets or sets the metadata path. /// </summary> /// <value>The metadata path.</value> - public string MetadataPath { get; set; } - public string MetadataNetworkPath { get; set; } + public string MetadataPath { get; set; } = string.Empty; + + public string MetadataNetworkPath { get; set; } = string.Empty; /// <summary> /// Gets or sets the preferred metadata language. /// </summary> /// <value>The preferred metadata language.</value> - public string PreferredMetadataLanguage { get; set; } + public string PreferredMetadataLanguage { get; set; } = "en"; /// <summary> /// Gets or sets the metadata country code. /// </summary> /// <value>The metadata country code.</value> - public string MetadataCountryCode { get; set; } + public string MetadataCountryCode { get; set; } = "US"; /// <summary> - /// Characters to be replaced with a ' ' in strings to create a sort name + /// Gets or sets characters to be replaced with a ' ' in strings to create a sort name. /// </summary> /// <value>The sort replace characters.</value> - public string[] SortReplaceCharacters { get; set; } + public string[] SortReplaceCharacters { get; set; } = new[] { ".", "+", "%" }; /// <summary> - /// Characters to be removed from strings to create a sort name + /// Gets or sets characters to be removed from strings to create a sort name. /// </summary> /// <value>The sort remove characters.</value> - public string[] SortRemoveCharacters { get; set; } + public string[] SortRemoveCharacters { get; set; } = new[] { ",", "&", "-", "{", "}", "'" }; /// <summary> - /// Words to be removed from strings to create a sort name + /// Gets or sets words to be removed from strings to create a sort name. /// </summary> /// <value>The sort remove words.</value> - public string[] SortRemoveWords { get; set; } + public string[] SortRemoveWords { get; set; } = new[] { "the", "a", "an" }; /// <summary> /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated. /// </summary> /// <value>The min resume PCT.</value> - public int MinResumePct { get; set; } + public int MinResumePct { get; set; } = 5; /// <summary> /// Gets or sets the maximum percentage of an item that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. /// </summary> /// <value>The max resume PCT.</value> - public int MaxResumePct { get; set; } + public int MaxResumePct { get; set; } = 90; /// <summary> /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates.. /// </summary> /// <value>The min resume duration seconds.</value> - public int MinResumeDurationSeconds { get; set; } + public int MinResumeDurationSeconds { get; set; } = 300; /// <summary> - /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed + /// Gets or sets the minimum minutes of a book that must be played in order for playstate to be updated. + /// </summary> + /// <value>The min resume in minutes.</value> + public int MinAudiobookResume { get; set; } = 5; + + /// <summary> + /// Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched. + /// </summary> + /// <value>The remaining time in minutes.</value> + public int MaxAudiobookResume { get; set; } = 5; + + /// <summary> + /// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several /// different directories and files. /// </summary> /// <value>The file watcher delay.</value> - public int LibraryMonitorDelay { get; set; } + public int LibraryMonitorDelay { get; set; } = 60; /// <summary> /// Gets or sets a value indicating whether [enable dashboard response caching]. /// Allows potential contributors without visual studio to modify production dashboard code and test changes. /// </summary> /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value> - public bool EnableDashboardResponseCaching { get; set; } - - /// <summary> - /// Allows the dashboard to be served from a custom path. - /// </summary> - /// <value>The dashboard source path.</value> - public string DashboardSourcePath { get; set; } + public bool EnableDashboardResponseCaching { get; set; } = true; /// <summary> /// Gets or sets the image saving convention. @@ -158,146 +333,131 @@ namespace MediaBrowser.Model.Configuration public MetadataOptions[] MetadataOptions { get; set; } - public bool EnableAutomaticRestart { get; set; } - public bool SkipDeserializationForBasicTypes { get; set; } + public bool SkipDeserializationForBasicTypes { get; set; } = true; - public string ServerName { get; set; } - public string WanDdns { get; set; } + public string ServerName { get; set; } = string.Empty; - public string UICulture { get; set; } + public string BaseUrl + { + get => _baseUrl; + set + { + // Normalize the start of the string + if (string.IsNullOrWhiteSpace(value)) + { + // If baseUrl is empty, set an empty prefix string + _baseUrl = string.Empty; + return; + } - public bool SaveMetadataHidden { get; set; } + if (value[0] != '/') + { + // If baseUrl was not configured with a leading slash, append one for consistency + value = "/" + value; + } - public NameValuePair[] ContentTypes { get; set; } + // Normalize the end of the string + if (value[value.Length - 1] == '/') + { + // If baseUrl was configured with a trailing slash, remove it for consistency + value = value.Remove(value.Length - 1); + } - public int RemoteClientBitrateLimit { get; set; } + _baseUrl = value; + } + } + + public string UICulture { get; set; } = "en-US"; - public bool EnableFolderView { get; set; } - public bool EnableGroupingIntoCollections { get; set; } - public bool DisplaySpecialsWithinSeasons { get; set; } - public string[] LocalNetworkSubnets { get; set; } - public string[] LocalNetworkAddresses { get; set; } - public string[] CodecsUsed { get; set; } - public bool EnableExternalContentInSuggestions { get; set; } - public bool RequireHttps { get; set; } - public bool IsBehindProxy { get; set; } - public bool EnableNewOmdbSupport { get; set; } + public bool SaveMetadataHidden { get; set; } = false; - public string[] RemoteIPFilter { get; set; } - public bool IsRemoteIPFilterBlacklist { get; set; } + public NameValuePair[] ContentTypes { get; set; } = Array.Empty<NameValuePair>(); - public int ImageExtractionTimeoutMs { get; set; } + public int RemoteClientBitrateLimit { get; set; } = 0; - public PathSubstitution[] PathSubstitutions { get; set; } - public bool EnableSimpleArtistDetection { get; set; } + public bool EnableFolderView { get; set; } = false; - public string[] UninstalledPlugins { get; set; } + public bool EnableGroupingIntoCollections { get; set; } = false; + + public bool DisplaySpecialsWithinSeasons { get; set; } = true; /// <summary> - /// Initializes a new instance of the <see cref="ServerConfiguration" /> class. + /// Gets or sets the subnets that are deemed to make up the LAN. /// </summary> - public ServerConfiguration() - { - UninstalledPlugins = Array.Empty<string>(); - RemoteIPFilter = Array.Empty<string>(); - LocalNetworkSubnets = Array.Empty<string>(); - LocalNetworkAddresses = Array.Empty<string>(); - CodecsUsed = Array.Empty<string>(); - ImageExtractionTimeoutMs = 0; - PathSubstitutions = Array.Empty<PathSubstitution>(); - EnableSimpleArtistDetection = true; + public string[] LocalNetworkSubnets { get; set; } = Array.Empty<string>(); - DisplaySpecialsWithinSeasons = true; - EnableExternalContentInSuggestions = true; + /// <summary> + /// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used. + /// </summary> + public string[] LocalNetworkAddresses { get; set; } = Array.Empty<string>(); - ImageSavingConvention = ImageSavingConvention.Compatible; - PublicPort = DefaultHttpPort; - PublicHttpsPort = DefaultHttpsPort; - HttpServerPortNumber = DefaultHttpPort; - HttpsPortNumber = DefaultHttpsPort; - EnableHttps = true; - EnableDashboardResponseCaching = true; - EnableCaseSensitiveItemIds = true; + public string[] CodecsUsed { get; set; } = Array.Empty<string>(); - EnableAutomaticRestart = true; - AutoRunWebApp = true; - EnableRemoteAccess = true; + public List<RepositoryInfo> PluginRepositories { get; set; } = new List<RepositoryInfo>(); - EnableUPnP = true; - MinResumePct = 5; - MaxResumePct = 90; + public bool EnableExternalContentInSuggestions { get; set; } = true; - // 5 minutes - MinResumeDurationSeconds = 300; + /// <summary> + /// Gets or sets a value indicating whether the server should force connections over HTTPS. + /// </summary> + public bool RequireHttps { get; set; } = false; - LibraryMonitorDelay = 60; + public bool EnableNewOmdbSupport { get; set; } = true; - ContentTypes = Array.Empty<NameValuePair>(); + /// <summary> + /// Gets or sets the filter for remote IP connectivity. Used in conjuntion with <seealso cref="IsRemoteIPFilterBlacklist"/>. + /// </summary> + public string[] RemoteIPFilter { get; set; } = Array.Empty<string>(); - PreferredMetadataLanguage = "en"; - MetadataCountryCode = "US"; + /// <summary> + /// Gets or sets a value indicating whether <seealso cref="RemoteIPFilter"/> contains a blacklist or a whitelist. Default is a whitelist. + /// </summary> + public bool IsRemoteIPFilterBlacklist { get; set; } = false; - SortReplaceCharacters = new[] { ".", "+", "%" }; - SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" }; - SortRemoveWords = new[] { "the", "a", "an" }; + public int ImageExtractionTimeoutMs { get; set; } = 0; - UICulture = "en-US"; + public PathSubstitution[] PathSubstitutions { get; set; } = Array.Empty<PathSubstitution>(); - MetadataOptions = new[] - { - new MetadataOptions() - { - ItemType = "Book" - }, - new MetadataOptions() - { - ItemType = "Movie" - }, - new MetadataOptions - { - ItemType = "MusicVideo", - DisabledMetadataFetchers = new [] { "The Open Movie Database" }, - DisabledImageFetchers = new [] { "The Open Movie Database", "FanArt" } - }, - new MetadataOptions - { - ItemType = "Series", - DisabledMetadataFetchers = new [] { "TheMovieDb" }, - DisabledImageFetchers = new [] { "TheMovieDb" } - }, - new MetadataOptions - { - ItemType = "MusicAlbum", - DisabledMetadataFetchers = new [] { "TheAudioDB" } - }, - new MetadataOptions - { - ItemType = "MusicArtist", - DisabledMetadataFetchers = new [] { "TheAudioDB" } - }, - new MetadataOptions - { - ItemType = "BoxSet" - }, - new MetadataOptions - { - ItemType = "Season", - DisabledMetadataFetchers = new [] { "TheMovieDb" }, - DisabledImageFetchers = new [] { "FanArt" } - }, - new MetadataOptions - { - ItemType = "Episode", - DisabledMetadataFetchers = new [] { "The Open Movie Database", "TheMovieDb" }, - DisabledImageFetchers = new [] { "The Open Movie Database", "TheMovieDb" } - } - }; - } - } + public string[] UninstalledPlugins { get; set; } = Array.Empty<string>(); - public class PathSubstitution - { - public string From { get; set; } - public string To { get; set; } + /// <summary> + /// Gets or sets a value indicating whether slow server responses should be logged as a warning. + /// </summary> + public bool EnableSlowResponseWarning { get; set; } = true; + + /// <summary> + /// Gets or sets the threshold for the slow response time warning in ms. + /// </summary> + public long SlowResponseThresholdMs { get; set; } = 500; + + /// <summary> + /// Gets or sets the cors hosts. + /// </summary> + public string[] CorsHosts { get; set; } = new[] { "*" }; + + /// <summary> + /// Gets or sets the known proxies. + /// </summary> + public string[] KnownProxies { get; set; } = Array.Empty<string>(); + + /// <summary> + /// Gets or sets the number of days we should retain activity logs. + /// </summary> + public int? ActivityLogRetentionDays { get; set; } = 30; + + /// <summary> + /// Gets or sets the how the library scan fans out. + /// </summary> + public int LibraryScanFanoutConcurrency { get; set; } + + /// <summary> + /// Gets or sets the how many metadata refreshes can run concurrently. + /// </summary> + public int LibraryMetadataRefreshConcurrency { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether older plugins should automatically be deleted from the plugin folder. + /// </summary> + public bool RemoveOldPlugins { get; set; } } } diff --git a/MediaBrowser.Model/Configuration/SubtitlePlaybackMode.cs b/MediaBrowser.Model/Configuration/SubtitlePlaybackMode.cs deleted file mode 100644 index fc429934f..000000000 --- a/MediaBrowser.Model/Configuration/SubtitlePlaybackMode.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public enum SubtitlePlaybackMode - { - Default = 0, - Always = 1, - OnlyForced = 2, - None = 3, - Smart = 4 - } -} diff --git a/MediaBrowser.Model/Configuration/TypeOptions.cs b/MediaBrowser.Model/Configuration/TypeOptions.cs new file mode 100644 index 000000000..d0179e5aa --- /dev/null +++ b/MediaBrowser.Model/Configuration/TypeOptions.cs @@ -0,0 +1,365 @@ +#nullable disable +#pragma warning disable CS1591 + +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Configuration +{ + public class TypeOptions + { + public static readonly ImageOption DefaultInstance = new ImageOption(); + + public static readonly Dictionary<string, ImageOption[]> DefaultImageOptions = new Dictionary<string, ImageOption[]> + { + { + "Movie", new[] + { + new ImageOption + { + Limit = 1, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Art + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Disc + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + }, + + new ImageOption + { + Limit = 0, + Type = ImageType.Banner + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Thumb + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Logo + } + } + }, + { + "MusicVideo", new[] + { + new ImageOption + { + Limit = 1, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Art + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Disc + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + }, + + new ImageOption + { + Limit = 0, + Type = ImageType.Banner + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Thumb + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Logo + } + } + }, + { + "Series", new[] + { + new ImageOption + { + Limit = 1, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Art + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Banner + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Thumb + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Logo + } + } + }, + { + "MusicAlbum", new[] + { + new ImageOption + { + Limit = 0, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Disc + } + } + }, + { + "MusicArtist", new[] + { + new ImageOption + { + Limit = 1, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + // Don't download this by default + // They do look great, but most artists won't have them, which means a banner view isn't really possible + new ImageOption + { + Limit = 0, + Type = ImageType.Banner + }, + + // Don't download this by default + // Generally not used + new ImageOption + { + Limit = 0, + Type = ImageType.Art + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Logo + } + } + }, + { + "BoxSet", new[] + { + new ImageOption + { + Limit = 1, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Thumb + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Logo + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Art + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Disc + }, + + // Don't download this by default as it's rarely used. + new ImageOption + { + Limit = 0, + Type = ImageType.Banner + } + } + }, + { + "Season", new[] + { + new ImageOption + { + Limit = 0, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + }, + + new ImageOption + { + Limit = 0, + Type = ImageType.Banner + }, + + new ImageOption + { + Limit = 0, + Type = ImageType.Thumb + } + } + }, + { + "Episode", new[] + { + new ImageOption + { + Limit = 0, + MinWidth = 1280, + Type = ImageType.Backdrop + }, + + new ImageOption + { + Limit = 1, + Type = ImageType.Primary + } + } + } + }; + + public TypeOptions() + { + MetadataFetchers = Array.Empty<string>(); + MetadataFetcherOrder = Array.Empty<string>(); + ImageFetchers = Array.Empty<string>(); + ImageFetcherOrder = Array.Empty<string>(); + ImageOptions = Array.Empty<ImageOption>(); + } + + public string Type { get; set; } + + public string[] MetadataFetchers { get; set; } + + public string[] MetadataFetcherOrder { get; set; } + + public string[] ImageFetchers { get; set; } + + public string[] ImageFetcherOrder { get; set; } + + public ImageOption[] ImageOptions { get; set; } + + public ImageOption GetImageOptions(ImageType type) + { + foreach (var i in ImageOptions) + { + if (i.Type == type) + { + return i; + } + } + + if (DefaultImageOptions.TryGetValue(Type, out ImageOption[] options)) + { + foreach (var i in options) + { + if (i.Type == type) + { + return i; + } + } + } + + return DefaultInstance; + } + + public int GetLimit(ImageType type) + { + return GetImageOptions(type).Limit; + } + + public int GetMinWidth(ImageType type) + { + return GetImageOptions(type).MinWidth; + } + + public bool IsEnabled(ImageType type) + { + return GetLimit(type) > 0; + } + } +} diff --git a/MediaBrowser.Model/Configuration/UnratedItem.cs b/MediaBrowser.Model/Configuration/UnratedItem.cs deleted file mode 100644 index 107b4e520..000000000 --- a/MediaBrowser.Model/Configuration/UnratedItem.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public enum UnratedItem - { - Movie, - Trailer, - Series, - Music, - Book, - LiveTvChannel, - LiveTvProgram, - ChannelContent, - Other - } -} diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index 689459eba..81359462c 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -1,17 +1,38 @@ +#pragma warning disable CS1591 + using System; +using Jellyfin.Data.Enums; namespace MediaBrowser.Model.Configuration { /// <summary> - /// Class UserConfiguration + /// Class UserConfiguration. /// </summary> public class UserConfiguration { /// <summary> + /// Initializes a new instance of the <see cref="UserConfiguration" /> class. + /// </summary> + public UserConfiguration() + { + EnableNextEpisodeAutoPlay = true; + RememberAudioSelections = true; + RememberSubtitleSelections = true; + + HidePlayedInLatest = true; + PlayDefaultAudioTrack = true; + + LatestItemsExcludes = Array.Empty<string>(); + OrderedViews = Array.Empty<string>(); + MyMediaExcludes = Array.Empty<string>(); + GroupedFolders = Array.Empty<string>(); + } + + /// <summary> /// Gets or sets the audio language preference. /// </summary> /// <value>The audio language preference.</value> - public string AudioLanguagePreference { get; set; } + public string? AudioLanguagePreference { get; set; } /// <summary> /// Gets or sets a value indicating whether [play default audio track]. @@ -23,13 +44,14 @@ namespace MediaBrowser.Model.Configuration /// Gets or sets the subtitle language preference. /// </summary> /// <value>The subtitle language preference.</value> - public string SubtitleLanguagePreference { get; set; } + public string? SubtitleLanguagePreference { get; set; } public bool DisplayMissingEpisodes { get; set; } public string[] GroupedFolders { get; set; } public SubtitlePlaybackMode SubtitleMode { get; set; } + public bool DisplayCollectionsView { get; set; } public bool EnableLocalPassword { get; set; } @@ -37,30 +59,15 @@ namespace MediaBrowser.Model.Configuration public string[] OrderedViews { get; set; } public string[] LatestItemsExcludes { get; set; } + public string[] MyMediaExcludes { get; set; } public bool HidePlayedInLatest { get; set; } public bool RememberAudioSelections { get; set; } - public bool RememberSubtitleSelections { get; set; } - public bool EnableNextEpisodeAutoPlay { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="UserConfiguration" /> class. - /// </summary> - public UserConfiguration() - { - EnableNextEpisodeAutoPlay = true; - RememberAudioSelections = true; - RememberSubtitleSelections = true; - HidePlayedInLatest = true; - PlayDefaultAudioTrack = true; + public bool RememberSubtitleSelections { get; set; } - LatestItemsExcludes = Array.Empty<string>(); - OrderedViews = Array.Empty<string>(); - MyMediaExcludes = Array.Empty<string>(); - GroupedFolders = Array.Empty<string>(); - } + public bool EnableNextEpisodeAutoPlay { get; set; } } } diff --git a/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs b/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs index 19e6be166..07129d715 100644 --- a/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs @@ -1,16 +1,9 @@ +#pragma warning disable CS1591 + namespace MediaBrowser.Model.Configuration { public class XbmcMetadataOptions { - public string UserId { get; set; } - - public string ReleaseDateFormat { get; set; } - - public bool SaveImagePathsInNfo { get; set; } - public bool EnablePathSubstitution { get; set; } - - public bool EnableExtraThumbsDuplication { get; set; } - public XbmcMetadataOptions() { ReleaseDateFormat = "yyyy-MM-dd"; @@ -18,5 +11,15 @@ namespace MediaBrowser.Model.Configuration SaveImagePathsInNfo = true; EnablePathSubstitution = true; } + + public string? UserId { get; set; } + + public string ReleaseDateFormat { get; set; } + + public bool SaveImagePathsInNfo { get; set; } + + public bool EnablePathSubstitution { get; set; } + + public bool EnableExtraThumbsDuplication { get; set; } } } |
