diff options
| author | the1HOknocks <the1HOknocks@randohg.com> | 2026-10-18 10:58:14 +0000 |
|---|---|---|
| committer | the1HOknocks <the1HOknocks@randohg.com> | 2026-10-18 10:58:14 +0000 |
| commit | 5cc214943cfd70154f0a2a3ae8139a1a1e69e71d (patch) | |
| tree | b74c395aac578c60c6b5ee56959515abbdb74700 /MediaBrowser.Model/Configuration | |
| parent | 292b13d1daf36316274211a8b3c13385c60efdb5 (diff) | |
Keep defaults out of DTOs while keeping API compatibility
Diffstat (limited to 'MediaBrowser.Model/Configuration')
4 files changed, 46 insertions, 150 deletions
diff --git a/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs b/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs index 755ba577ca..0bc009f402 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs @@ -1,7 +1,6 @@ #pragma warning disable CA1819 #nullable disable -using System.ComponentModel; using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Configuration; @@ -12,56 +11,6 @@ namespace MediaBrowser.Model.Configuration; public class EncodingOptionsDto { /// <summary> - /// Initializes a new instance of the <see cref="EncodingOptionsDto" /> class. - /// </summary> - public EncodingOptionsDto() - { - EnableFallbackFont = false; - EnableAudioVbr = false; - DownMixAudioBoost = 2; - DownMixStereoAlgorithm = DownMixStereoAlgorithms.None; - MaxMuxingQueueSize = 2048; - EnableThrottling = false; - ThrottleDelaySeconds = 180; - EnableSegmentDeletion = false; - SegmentKeepSeconds = 720; - EncodingThreadCount = -1; - VaapiDevice = "/dev/dri/renderD128"; - QsvDevice = string.Empty; - EnableTonemapping = false; - EnableVppTonemapping = false; - EnableVideoToolboxTonemapping = false; - TonemappingAlgorithm = TonemappingAlgorithm.bt2390; - TonemappingMode = TonemappingMode.auto; - TonemappingRange = TonemappingRange.auto; - TonemappingDesat = 0; - TonemappingPeak = 100; - TonemappingParam = 0; - VppTonemappingBrightness = 16; - VppTonemappingContrast = 1; - H264Crf = 23; - H265Crf = 28; - DeinterlaceDoubleRate = false; - DeinterlaceMethod = DeinterlaceMethod.yadif; - EnableDecodingColorDepth10Hevc = true; - EnableDecodingColorDepth10Vp9 = true; - EnableDecodingColorDepth10HevcRext = false; - EnableDecodingColorDepth12HevcRext = false; - EnableEnhancedNvdecDecoder = true; - PreferSystemNativeHwDecoder = true; - EnableIntelLowPowerH264HwEncoder = false; - EnableIntelLowPowerHevcHwEncoder = false; - EnableHardwareEncoding = true; - AllowHevcEncoding = false; - AllowAv1Encoding = false; - EnableSubtitleExtraction = true; - SubtitleExtractionTimeoutMinutes = 30; - AllowOnDemandMetadataBasedKeyframeExtractionForExtensions = ["mkv"]; - HardwareDecodingCodecs = ["h264", "vc1"]; - HlsAudioSeekStrategy = HlsAudioSeekStrategy.DisableAccurateSeek; - } - - /// <summary> /// Gets or sets the thread count used for encoding. /// </summary> public int EncodingThreadCount { get; set; } @@ -214,7 +163,7 @@ public class EncodingOptionsDto /// <summary> /// Gets or sets the encoder preset. /// </summary> - public EncoderPreset? EncoderPreset { get; set; } + public EncoderPreset EncoderPreset { get; set; } /// <summary> /// Gets or sets a value indicating whether the framerate is doubled when deinterlacing. @@ -304,6 +253,5 @@ public class EncodingOptionsDto /// <summary> /// Gets or sets the method used for audio seeking in HLS. /// </summary> - [DefaultValue(HlsAudioSeekStrategy.DisableAccurateSeek)] public HlsAudioSeekStrategy HlsAudioSeekStrategy { get; set; } } diff --git a/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs b/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs index 8b39523bc7..e07f9e34de 100644 --- a/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs +++ b/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs @@ -8,5 +8,5 @@ public class MetadataConfigurationDto /// <summary> /// Gets or sets a value indicating whether to use file creation time for date added. /// </summary> - public bool UseFileCreationTimeForDateAdded { get; set; } = true; + public bool UseFileCreationTimeForDateAdded { get; set; } } diff --git a/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs b/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs index 62af8b9626..3f2bfe04f0 100644 --- a/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs +++ b/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs @@ -1,7 +1,6 @@ #pragma warning disable CS1591 #pragma warning disable CA1819 -using System; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; using MediaBrowser.Model.System; @@ -14,57 +13,6 @@ namespace MediaBrowser.Model.Configuration; /// </summary> public class ServerConfigurationDto { - /// <summary> - /// Initializes a new instance of the <see cref="ServerConfigurationDto" /> class. - /// </summary> - public ServerConfigurationDto() - { - LogFileRetentionDays = 3; - 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", - } - }; - } - public int LogFileRetentionDays { get; set; } public bool IsStartupWizardCompleted { get; set; } @@ -73,105 +21,105 @@ public class ServerConfigurationDto public string? PreviousVersionStr { get; set; } - public bool EnableMetrics { get; set; } = false; + public bool EnableMetrics { get; set; } - public bool EnableNormalizedItemByNameIds { get; set; } = true; + public bool EnableNormalizedItemByNameIds { get; set; } public bool IsPortAuthorized { get; set; } - public bool QuickConnectAvailable { get; set; } = true; + public bool QuickConnectAvailable { get; set; } - public bool EnableCaseSensitiveItemIds { get; set; } = true; + public bool EnableCaseSensitiveItemIds { get; set; } - public bool DisableLiveTvChannelUserDataName { get; set; } = true; + public bool DisableLiveTvChannelUserDataName { get; set; } - public string MetadataPath { get; set; } = string.Empty; + public string MetadataPath { get; set; } = null!; - public string PreferredMetadataLanguage { get; set; } = "en"; + public string PreferredMetadataLanguage { get; set; } = null!; - public string MetadataCountryCode { get; set; } = "US"; + public string MetadataCountryCode { get; set; } = null!; - public string[] SortReplaceCharacters { get; set; } = new[] { ".", "+", "%" }; + public string[] SortReplaceCharacters { get; set; } = null!; - public string[] SortRemoveCharacters { get; set; } = new[] { ",", "&", "-", "{", "}", "'" }; + public string[] SortRemoveCharacters { get; set; } = null!; - public string[] SortRemoveWords { get; set; } = new[] { "the", "a", "an" }; + public string[] SortRemoveWords { get; set; } = null!; - public int MinResumePct { get; set; } = 5; + public int MinResumePct { get; set; } - public int MaxResumePct { get; set; } = 90; + public int MaxResumePct { get; set; } - public int MinResumeDurationSeconds { get; set; } = 300; + public int MinResumeDurationSeconds { get; set; } - public int MinAudiobookResume { get; set; } = 5; + public int MinAudiobookResume { get; set; } - public int MaxAudiobookResume { get; set; } = 5; + public int MaxAudiobookResume { get; set; } public int InactiveSessionThreshold { get; set; } - public int LibraryMonitorDelay { get; set; } = 60; + public int LibraryMonitorDelay { get; set; } - public int LibraryUpdateDuration { get; set; } = 30; + public int LibraryUpdateDuration { get; set; } - public int CacheSize { get; set; } = Environment.ProcessorCount * 100; + public int CacheSize { get; set; } public ImageSavingConvention ImageSavingConvention { get; set; } - public MetadataOptions[] MetadataOptions { get; set; } + public MetadataOptions[] MetadataOptions { get; set; } = null!; - public bool SkipDeserializationForBasicTypes { get; set; } = true; + public bool SkipDeserializationForBasicTypes { get; set; } - public string ServerName { get; set; } = string.Empty; + public string ServerName { get; set; } = null!; - public string UICulture { get; set; } = "en-US"; + public string UICulture { get; set; } = null!; - public bool SaveMetadataHidden { get; set; } = false; + public bool SaveMetadataHidden { get; set; } - public NameValuePair[] ContentTypes { get; set; } = Array.Empty<NameValuePair>(); + public NameValuePair[] ContentTypes { get; set; } = null!; public int RemoteClientBitrateLimit { get; set; } - public bool EnableFolderView { get; set; } = false; + public bool EnableFolderView { get; set; } - public bool EnableGroupingMoviesIntoCollections { get; set; } = false; + public bool EnableGroupingMoviesIntoCollections { get; set; } - public bool EnableGroupingShowsIntoCollections { get; set; } = false; + public bool EnableGroupingShowsIntoCollections { get; set; } - public bool DisplaySpecialsWithinSeasons { get; set; } = true; + public bool DisplaySpecialsWithinSeasons { get; set; } - public string[] CodecsUsed { get; set; } = Array.Empty<string>(); + public string[] CodecsUsed { get; set; } = null!; - public RepositoryInfo[] PluginRepositories { get; set; } = Array.Empty<RepositoryInfo>(); + public RepositoryInfo[] PluginRepositories { get; set; } = null!; - public bool EnableExternalContentInSuggestions { get; set; } = true; + public bool EnableExternalContentInSuggestions { get; set; } public int ImageExtractionTimeoutMs { get; set; } - public PathSubstitution[] PathSubstitutions { get; set; } = Array.Empty<PathSubstitution>(); + public PathSubstitution[] PathSubstitutions { get; set; } = null!; - public bool EnableSlowResponseWarning { get; set; } = true; + public bool EnableSlowResponseWarning { get; set; } - public long SlowResponseThresholdMs { get; set; } = 500; + public long SlowResponseThresholdMs { get; set; } - public string[] CorsHosts { get; set; } = new[] { "*" }; + public string[] CorsHosts { get; set; } = null!; - public int? ActivityLogRetentionDays { get; set; } = 30; + public int? ActivityLogRetentionDays { get; set; } public int LibraryScanFanoutConcurrency { get; set; } public int LibraryMetadataRefreshConcurrency { get; set; } - public bool AllowClientLogUpload { get; set; } = true; + public bool AllowClientLogUpload { get; set; } public int DummyChapterDuration { get; set; } - public ImageResolution ChapterImageResolution { get; set; } = ImageResolution.MatchSource; + public ImageResolution ChapterImageResolution { get; set; } public int ParallelImageEncodingLimit { get; set; } - public CastReceiverApplication[] CastReceiverApplications { get; set; } = Array.Empty<CastReceiverApplication>(); + public CastReceiverApplication[] CastReceiverApplications { get; set; } = null!; - public TrickplayOptions TrickplayOptions { get; set; } = new TrickplayOptions(); + public TrickplayOptions TrickplayOptions { get; set; } = null!; public bool EnableLegacyAuthorization { get; set; } } diff --git a/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs b/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs index ba27381dae..e2c118ddbe 100644 --- a/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs +++ b/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs @@ -13,17 +13,17 @@ public class XbmcMetadataOptionsDto /// <summary> /// Gets or sets the release date format. /// </summary> - public string ReleaseDateFormat { get; set; } = "yyyy-MM-dd"; + public string ReleaseDateFormat { get; set; } = null!; /// <summary> /// Gets or sets a value indicating whether to save image paths in NFO. /// </summary> - public bool SaveImagePathsInNfo { get; set; } = true; + public bool SaveImagePathsInNfo { get; set; } /// <summary> /// Gets or sets a value indicating whether to enable path substitution. /// </summary> - public bool EnablePathSubstitution { get; set; } = true; + public bool EnablePathSubstitution { get; set; } /// <summary> /// Gets or sets a value indicating whether to enable extra thumbs duplication. |
