< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Extensions.ConfigurationExtensions
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs
Line coverage
55%
Covered lines: 5
Uncovered lines: 4
Coverable lines: 9
Total lines: 150
Line coverage: 55.5%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
HostWebClient(...)100%11100%
GetFFmpegProbeSize(...)100%11100%
GetFFmpegAnalyzeDuration(...)100%11100%
GetFFmpegSkipValidation(...)100%11100%
DoPlaylistsAllowDuplicates(...)100%210%
UseUnixSocket(...)100%210%
GetUnixSocketPath(...)100%210%
GetUnixSocketPermissions(...)100%210%
GetSqliteCacheSize(...)100%11100%

File(s)

/srv/git/jellyfin/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs

#LineLine coverage
 1using System;
 2using Microsoft.Extensions.Configuration;
 3
 4namespace MediaBrowser.Controller.Extensions
 5{
 6    /// <summary>
 7    /// Configuration extensions for <c>MediaBrowser.Controller</c>.
 8    /// </summary>
 9    public static class ConfigurationExtensions
 10    {
 11        /// <summary>
 12        /// The key for a setting that specifies the default redirect path
 13        /// to use for requests where the URL base prefix is invalid or missing..
 14        /// </summary>
 15        public const string DefaultRedirectKey = "DefaultRedirectPath";
 16
 17        /// <summary>
 18        /// The key for the address override option.
 19        /// </summary>
 20        public const string AddressOverrideKey = "PublishedServerUrl";
 21
 22        /// <summary>
 23        /// The key for a setting that indicates whether the application should host web client content.
 24        /// </summary>
 25        public const string HostWebClientKey = "hostwebclient";
 26
 27        /// <summary>
 28        /// The key for the FFmpeg probe size option.
 29        /// </summary>
 30        public const string FfmpegProbeSizeKey = "FFmpeg:probesize";
 31
 32        /// <summary>
 33        /// The key for the skipping FFmpeg validation.
 34        /// </summary>
 35        public const string FfmpegSkipValidationKey = "FFmpeg:novalidation";
 36
 37        /// <summary>
 38        /// The key for the FFmpeg analyze duration option.
 39        /// </summary>
 40        public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration";
 41
 42        /// <summary>
 43        /// The key for the FFmpeg path option.
 44        /// </summary>
 45        public const string FfmpegPathKey = "ffmpeg";
 46
 47        /// <summary>
 48        /// The key for a setting that indicates whether playlists should allow duplicate entries.
 49        /// </summary>
 50        public const string PlaylistsAllowDuplicatesKey = "playlists:allowDuplicates";
 51
 52        /// <summary>
 53        /// The key for a setting that indicates whether kestrel should bind to a unix socket.
 54        /// </summary>
 55        public const string BindToUnixSocketKey = "kestrel:socket";
 56
 57        /// <summary>
 58        /// The key for the unix socket path.
 59        /// </summary>
 60        public const string UnixSocketPathKey = "kestrel:socketPath";
 61
 62        /// <summary>
 63        /// The permissions for the unix socket.
 64        /// </summary>
 65        public const string UnixSocketPermissionsKey = "kestrel:socketPermissions";
 66
 67        /// <summary>
 68        /// The cache size of the SQL database, see cache_size.
 69        /// </summary>
 70        public const string SqliteCacheSizeKey = "sqlite:cacheSize";
 71
 72        /// <summary>
 73        /// The key for a setting that indicates whether the application should detect network status change.
 74        /// </summary>
 75        public const string DetectNetworkChangeKey = "DetectNetworkChange";
 76
 77        /// <summary>
 78        /// Gets a value indicating whether the application should host static web content from the <see cref="IConfigur
 79        /// </summary>
 80        /// <param name="configuration">The configuration to retrieve the value from.</param>
 81        /// <returns>The parsed config value.</returns>
 82        /// <exception cref="FormatException">The config value is not a valid bool string. See <see cref="bool.Parse(str
 83        public static bool HostWebClient(this IConfiguration configuration)
 2284            => configuration.GetValue<bool>(HostWebClientKey);
 85
 86        /// <summary>
 87        /// Gets the FFmpeg probe size from the <see cref="IConfiguration" />.
 88        /// </summary>
 89        /// <param name="configuration">The configuration to read the setting from.</param>
 90        /// <returns>The FFmpeg probe size option.</returns>
 91        public static string? GetFFmpegProbeSize(this IConfiguration configuration)
 192            => configuration[FfmpegProbeSizeKey];
 93
 94        /// <summary>
 95        /// Gets the FFmpeg analyze duration from the <see cref="IConfiguration" />.
 96        /// </summary>
 97        /// <param name="configuration">The configuration to read the setting from.</param>
 98        /// <returns>The FFmpeg analyze duration option.</returns>
 99        public static string? GetFFmpegAnalyzeDuration(this IConfiguration configuration)
 1100            => configuration[FfmpegAnalyzeDurationKey];
 101
 102        /// <summary>
 103        /// Gets a value indicating whether the server should validate FFmpeg during startup.
 104        /// </summary>
 105        /// <param name="configuration">The configuration to read the setting from.</param>
 106        /// <returns><c>true</c> if the server should validate FFmpeg during startup, otherwise <c>false</c>.</returns>
 107        public static bool GetFFmpegSkipValidation(this IConfiguration configuration)
 22108            => configuration.GetValue<bool>(FfmpegSkipValidationKey);
 109
 110        /// <summary>
 111        /// Gets a value indicating whether playlists should allow duplicate entries from the <see cref="IConfiguration"
 112        /// </summary>
 113        /// <param name="configuration">The configuration to read the setting from.</param>
 114        /// <returns>True if playlists should allow duplicates, otherwise false.</returns>
 115        public static bool DoPlaylistsAllowDuplicates(this IConfiguration configuration)
 0116            => configuration.GetValue<bool>(PlaylistsAllowDuplicatesKey);
 117
 118        /// <summary>
 119        /// Gets a value indicating whether kestrel should bind to a unix socket from the <see cref="IConfiguration" />.
 120        /// </summary>
 121        /// <param name="configuration">The configuration to read the setting from.</param>
 122        /// <returns><c>true</c> if kestrel should bind to a unix socket, otherwise <c>false</c>.</returns>
 123        public static bool UseUnixSocket(this IConfiguration configuration)
 0124            => configuration.GetValue<bool>(BindToUnixSocketKey);
 125
 126        /// <summary>
 127        /// Gets the path for the unix socket from the <see cref="IConfiguration" />.
 128        /// </summary>
 129        /// <param name="configuration">The configuration to read the setting from.</param>
 130        /// <returns>The unix socket path.</returns>
 131        public static string? GetUnixSocketPath(this IConfiguration configuration)
 0132            => configuration[UnixSocketPathKey];
 133
 134        /// <summary>
 135        /// Gets the permissions for the unix socket from the <see cref="IConfiguration" />.
 136        /// </summary>
 137        /// <param name="configuration">The configuration to read the setting from.</param>
 138        /// <returns>The unix socket permissions.</returns>
 139        public static string? GetUnixSocketPermissions(this IConfiguration configuration)
 0140            => configuration[UnixSocketPermissionsKey];
 141
 142        /// <summary>
 143        /// Gets the cache_size from the <see cref="IConfiguration" />.
 144        /// </summary>
 145        /// <param name="configuration">The configuration to read the setting from.</param>
 146        /// <returns>The sqlite cache size.</returns>
 147        public static int? GetSqliteCacheSize(this IConfiguration configuration)
 46148            => configuration.GetValue<int?>(SqliteCacheSizeKey);
 149    }
 150}