< Summary - Jellyfin

Information
Class: Jellyfin.Server.StartupOptions
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/StartupOptions.cs
Line coverage
60%
Covered lines: 6
Uncovered lines: 4
Coverable lines: 10
Total lines: 107
Line coverage: 60%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
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
ConvertToConfig()50%12.1860%

File(s)

/srv/git/jellyfin/Jellyfin.Server/StartupOptions.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using CommandLine;
 3using Emby.Server.Implementations;
 4using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
 5
 6namespace Jellyfin.Server
 7{
 8    /// <summary>
 9    /// Class used by CommandLine package when parsing the command line arguments.
 10    /// </summary>
 11    public class StartupOptions : IStartupOptions
 12    {
 13        /// <summary>
 14        /// Gets or sets the path to the data directory.
 15        /// </summary>
 16        /// <value>The path to the data directory.</value>
 17        [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
 18        public string? DataDir { get; set; }
 19
 20        /// <summary>
 21        /// Gets or sets a value indicating whether the server should not host the web client.
 22        /// </summary>
 23        [Option("nowebclient", Required = false, HelpText = "Indicates that the web server should not host the web clien
 24        public bool NoWebClient { get; set; }
 25
 26        /// <summary>
 27        /// Gets or sets the path to the web directory.
 28        /// </summary>
 29        /// <value>The path to the web directory.</value>
 30        [Option('w', "webdir", Required = false, HelpText = "Path to the Jellyfin web UI resources.")]
 31        public string? WebDir { get; set; }
 32
 33        /// <summary>
 34        /// Gets or sets the path to the cache directory.
 35        /// </summary>
 36        /// <value>The path to the cache directory.</value>
 37        [Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")]
 38        public string? CacheDir { get; set; }
 39
 40        /// <summary>
 41        /// Gets or sets the path to the config directory.
 42        /// </summary>
 43        /// <value>The path to the config directory.</value>
 44        [Option('c', "configdir", Required = false, HelpText = "Path to use for configuration data (user settings and pi
 45        public string? ConfigDir { get; set; }
 46
 47        /// <summary>
 48        /// Gets or sets the path to the log directory.
 49        /// </summary>
 50        /// <value>The path to the log directory.</value>
 51        [Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")]
 52        public string? LogDir { get; set; }
 53
 54        /// <inheritdoc />
 55        [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg executable to use in place of default fo
 56        public string? FFmpegPath { get; set; }
 57
 58        /// <inheritdoc />
 59        [Option("service", Required = false, HelpText = "Run as headless service.")]
 60        public bool IsService { get; set; }
 61
 62        /// <inheritdoc />
 63        [Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
 64        public string? PackageName { get; set; }
 65
 66        /// <inheritdoc />
 67        [Option("published-server-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover p
 68        public string? PublishedServerUrl { get; set; }
 69
 70        /// <summary>
 71        /// Gets or sets a value indicating whether the server should not detect network status change.
 72        /// </summary>
 73        [Option("nonetchange", Required = false, HelpText = "Indicates that the server should not detect network status 
 74        public bool NoDetectNetworkChange { get; set; }
 75
 76        /// <summary>
 77        /// Gets the command line options as a dictionary that can be used in the .NET configuration system.
 78        /// </summary>
 79        /// <returns>The configuration dictionary.</returns>
 80        public Dictionary<string, string?> ConvertToConfig()
 81        {
 4482            var config = new Dictionary<string, string?>();
 83
 4484            if (NoWebClient)
 85            {
 086                config.Add(HostWebClientKey, bool.FalseString);
 87            }
 88
 4489            if (PublishedServerUrl is not null)
 90            {
 091                config.Add(AddressOverrideKey, PublishedServerUrl);
 92            }
 93
 4494            if (FFmpegPath is not null)
 95            {
 096                config.Add(FfmpegPathKey, FFmpegPath);
 97            }
 98
 4499            if (NoDetectNetworkChange)
 100            {
 0101                config.Add(DetectNetworkChangeKey, bool.FalseString);
 102            }
 103
 44104            return config;
 105        }
 106    }
 107}

Methods/Properties

ConvertToConfig()