From 85a58fd655240fd0ddd10bdaaad4a9bb8cd7051d Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 27 Jan 2019 15:40:37 +0100 Subject: Start startup tasks async --- Emby.Server.Implementations/EntryPoints/StartupWizard.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Emby.Server.Implementations/EntryPoints/StartupWizard.cs') diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index 05c8b07ab..1d44bffbb 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Emby.Server.Implementations.Browser; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; @@ -32,11 +33,11 @@ namespace Emby.Server.Implementations.EntryPoints /// /// Runs this instance. /// - public void Run() + public Task RunAsync() { if (!_appHost.CanLaunchWebBrowser) { - return; + return Task.CompletedTask; } if (!_config.Configuration.IsStartupWizardCompleted) @@ -52,6 +53,8 @@ namespace Emby.Server.Implementations.EntryPoints BrowserLauncher.OpenWebApp(_appHost); } } + + return Task.CompletedTask; } /// -- cgit v1.2.3 From fd361421b120b103b2abaf1e3b36c6715887afe4 Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Mon, 28 Jan 2019 13:41:37 +0000 Subject: Use CommandLineParser package for handling CLI args --- Emby.Server.Implementations/ApplicationHost.cs | 4 +- .../Emby.Server.Implementations.csproj | 1 + .../EntryPoints/StartupWizard.cs | 2 +- Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs | 4 +- Emby.Server.Implementations/StartupOptions.cs | 53 ++++++++++++++-------- Jellyfin.Server/CoreAppHost.cs | 2 +- Jellyfin.Server/Program.cs | 42 +++++++++-------- 7 files changed, 64 insertions(+), 44 deletions(-) (limited to 'Emby.Server.Implementations/EntryPoints/StartupWizard.cs') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 31dad48be..2306fb370 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -141,7 +141,7 @@ namespace Emby.Server.Implementations return false; } - if (StartupOptions.ContainsOption("-service")) + if (StartupOptions.Service) { return false; } @@ -1747,7 +1747,7 @@ namespace Emby.Server.Implementations EncoderLocationType = MediaEncoder.EncoderLocationType, SystemArchitecture = EnvironmentInfo.SystemArchitecture, SystemUpdateLevel = SystemUpdateLevel, - PackageName = StartupOptions.GetOption("-package") + PackageName = StartupOptions.PackageName }; } diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 3aa617b02..bf0546f2e 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -22,6 +22,7 @@ + diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index 05c8b07ab..bb96120f4 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints { var options = ((ApplicationHost)_appHost).StartupOptions; - if (!options.ContainsOption("-noautorunwebapp")) + if (!options.NoAutoRunWebApp) { BrowserLauncher.OpenWebApp(_appHost); } diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs index 79a42f294..4c926b91a 100644 --- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs +++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs @@ -30,8 +30,8 @@ namespace Emby.Server.Implementations.FFMpeg public FFMpegInfo GetFFMpegInfo(StartupOptions options) { - var customffMpegPath = options.GetOption("-ffmpeg"); - var customffProbePath = options.GetOption("-ffprobe"); + var customffMpegPath = options.FFmpeg; + var customffProbePath = options.FFprobe; if (!string.IsNullOrWhiteSpace(customffMpegPath) && !string.IsNullOrWhiteSpace(customffProbePath)) { diff --git a/Emby.Server.Implementations/StartupOptions.cs b/Emby.Server.Implementations/StartupOptions.cs index 221263634..fca60afb8 100644 --- a/Emby.Server.Implementations/StartupOptions.cs +++ b/Emby.Server.Implementations/StartupOptions.cs @@ -1,30 +1,43 @@ -using System; -using System.Linq; - namespace Emby.Server.Implementations { + using CommandLine; + + /// + /// Class used by CommandLine package when parsing the command line arguments. + /// public class StartupOptions { - private readonly string[] _options; + [Option('d', "programdata", Required = false, HelpText = "Path to use for program data (databases files etc.).")] + public string PathProgramData { get; set; } + + [Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")] + public string PathConfig { get; set; } + + [Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")] + public string PathLog { get; set; } + + + [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg exe to use in place of built-in.")] + public string FFmpeg { get; set; } + + [Option("ffprobe", Required = false, HelpText = "ffmpeg and ffprobe switches must be supplied together.")] + public string FFprobe { get; set; } + + + [Option("service", Required = false, HelpText = "Run as headless service.")] + public bool Service { get; set; } - public StartupOptions(string[] commandLineArgs) - { - _options = commandLineArgs; - } + [Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")] + public bool NoAutoRunWebApp { get; set; } - public bool ContainsOption(string option) - => _options.Contains(option, StringComparer.OrdinalIgnoreCase); + [Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")] + public string PackageName { get; set; } - public string GetOption(string name) - { - int index = Array.IndexOf(_options, name); - if (index == -1) - { - return null; - } + [Option("restartpath", Required = false, HelpText = "Path to reset script.")] + public string RestartPath { get; set; } - return _options.ElementAtOrDefault(index + 1); - } + [Option("restartargs", Required = false, HelpText = "Arguments for restart script.")] + public string RestartArgs { get; set; } } -} + } diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs index b580f45ca..5182ab4d7 100644 --- a/Jellyfin.Server/CoreAppHost.cs +++ b/Jellyfin.Server/CoreAppHost.cs @@ -16,7 +16,7 @@ namespace Jellyfin.Server { } - public override bool CanSelfRestart => StartupOptions.ContainsOption("-restartpath"); + public override bool CanSelfRestart => StartupOptions.RestartPath != null; protected override void RestartInternal() => Program.Restart(); diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 66586d4e4..dbfd59ebf 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -26,6 +26,8 @@ using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Jellyfin.Server { + using CommandLine; + public static class Program { private static readonly CancellationTokenSource _tokenSource = new CancellationTokenSource(); @@ -35,14 +37,18 @@ namespace Jellyfin.Server public static async Task Main(string[] args) { - StartupOptions options = new StartupOptions(args); - Version version = Assembly.GetEntryAssembly().GetName().Version; - - if (options.ContainsOption("-v") || options.ContainsOption("--version")) - { - Console.WriteLine(version.ToString()); - } + // For CommandLine package, change default behaviour to output errors to stdout (instead of stderr) + var parser = new Parser(config => config.HelpWriter = Console.Out); + + // Parse the command line arguments and either start the app or exit indicating error + await parser.ParseArguments(args) + .MapResult( + options => StartApp(options), + errs => Task.FromResult(0)).ConfigureAwait(false); + } + private static async Task StartApp(StartupOptions options) + { ServerApplicationPaths appPaths = CreateApplicationPaths(options); // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager @@ -78,7 +84,7 @@ namespace Jellyfin.Server Shutdown(); }; - _logger.LogInformation("Jellyfin version: {Version}", version); + _logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version); EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem()); ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo); @@ -133,9 +139,9 @@ namespace Jellyfin.Server string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH"); if (string.IsNullOrEmpty(programDataPath)) { - if (options.ContainsOption("-programdata")) + if (options.PathProgramData != null) { - programDataPath = options.GetOption("-programdata"); + programDataPath = options.PathProgramData; } else { @@ -171,9 +177,9 @@ namespace Jellyfin.Server string configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR"); if (string.IsNullOrEmpty(configDir)) { - if (options.ContainsOption("-configdir")) + if (options.PathConfig != null) { - configDir = options.GetOption("-configdir"); + configDir = options.PathConfig; } else { @@ -190,9 +196,9 @@ namespace Jellyfin.Server string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR"); if (string.IsNullOrEmpty(logDir)) { - if (options.ContainsOption("-logdir")) + if (options.PathLog != null) { - logDir = options.GetOption("-logdir"); + logDir = options.PathLog; } else { @@ -315,11 +321,11 @@ namespace Jellyfin.Server Shutdown(); } - private static void StartNewInstance(StartupOptions startupOptions) + private static void StartNewInstance(StartupOptions options) { _logger.LogInformation("Starting new instance"); - string module = startupOptions.GetOption("-restartpath"); + string module = options.RestartPath; if (string.IsNullOrWhiteSpace(module)) { @@ -328,9 +334,9 @@ namespace Jellyfin.Server string commandLineArgsString; - if (startupOptions.ContainsOption("-restartargs")) + if (options.RestartArgs != null) { - commandLineArgsString = startupOptions.GetOption("-restartargs") ?? string.Empty; + commandLineArgsString = options.RestartArgs ?? string.Empty; } else { -- cgit v1.2.3 From e18b89ca275feceee21b540878017a2373e7de6c Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Mon, 28 Jan 2019 20:58:47 +0000 Subject: Move Options to Jellyfin.Server and create interface file Changes following review comments. --- Emby.Server.Implementations/ApplicationHost.cs | 7 +-- .../Emby.Server.Implementations.csproj | 3 +- .../EntryPoints/StartupWizard.cs | 2 +- Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs | 7 +-- Emby.Server.Implementations/IStartupOptions.cs | 55 ++++++++++++++++++++++ Emby.Server.Implementations/StartupOptions.cs | 43 ----------------- Jellyfin.Server/Jellyfin.Server.csproj | 1 + Jellyfin.Server/Program.cs | 21 ++++----- Jellyfin.Server/StartupOptions.cs | 47 ++++++++++++++++++ 9 files changed, 123 insertions(+), 63 deletions(-) create mode 100644 Emby.Server.Implementations/IStartupOptions.cs delete mode 100644 Emby.Server.Implementations/StartupOptions.cs create mode 100644 Jellyfin.Server/StartupOptions.cs (limited to 'Emby.Server.Implementations/EntryPoints/StartupWizard.cs') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 2306fb370..3af9e487e 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -43,6 +43,7 @@ using Emby.Server.Implementations.ScheduledTasks; using Emby.Server.Implementations.Security; using Emby.Server.Implementations.Serialization; using Emby.Server.Implementations.Session; +using Emby.Server.Implementations.ParsedStartupOptions; using Emby.Server.Implementations.Threading; using Emby.Server.Implementations.TV; using Emby.Server.Implementations.Updates; @@ -141,7 +142,7 @@ namespace Emby.Server.Implementations return false; } - if (StartupOptions.Service) + if (StartupOptions.IsService) { return false; } @@ -343,7 +344,7 @@ namespace Emby.Server.Implementations protected IHttpResultFactory HttpResultFactory { get; private set; } protected IAuthService AuthService { get; private set; } - public StartupOptions StartupOptions { get; private set; } + public IStartupOptions StartupOptions { get; private set; } internal IImageEncoder ImageEncoder { get; private set; } @@ -364,7 +365,7 @@ namespace Emby.Server.Implementations /// public ApplicationHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, - StartupOptions options, + IStartupOptions options, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, IImageEncoder imageEncoder, diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index bf0546f2e..92e3172f1 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -1,4 +1,4 @@ - + @@ -22,7 +22,6 @@ - diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index bb96120f4..43d18e135 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints { var options = ((ApplicationHost)_appHost).StartupOptions; - if (!options.NoAutoRunWebApp) + if (options.AutoRunWebApp) { BrowserLauncher.OpenWebApp(_appHost); } diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs index 4c926b91a..b422b8862 100644 --- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs +++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs @@ -6,6 +6,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; using Microsoft.Extensions.Logging; +using Emby.Server.Implementations.ParsedStartupOptions; namespace Emby.Server.Implementations.FFMpeg { @@ -28,10 +29,10 @@ namespace Emby.Server.Implementations.FFMpeg _ffmpegInstallInfo = ffmpegInstallInfo; } - public FFMpegInfo GetFFMpegInfo(StartupOptions options) + public FFMpegInfo GetFFMpegInfo(IStartupOptions options) { - var customffMpegPath = options.FFmpeg; - var customffProbePath = options.FFprobe; + var customffMpegPath = options.FFmpegPath; + var customffProbePath = options.FFprobePath; if (!string.IsNullOrWhiteSpace(customffMpegPath) && !string.IsNullOrWhiteSpace(customffProbePath)) { diff --git a/Emby.Server.Implementations/IStartupOptions.cs b/Emby.Server.Implementations/IStartupOptions.cs new file mode 100644 index 000000000..878bb6640 --- /dev/null +++ b/Emby.Server.Implementations/IStartupOptions.cs @@ -0,0 +1,55 @@ +namespace Emby.Server.Implementations.ParsedStartupOptions +{ + public interface IStartupOptions + { + /// + /// --datadir + /// + string DataDir { get; } + + /// + /// --configdir + /// + string ConfigDir { get; } + + /// + /// --logdir + /// + string LogDir { get; } + + /// + /// --ffmpeg + /// + string FFmpegPath { get; } + + /// + /// --ffprobe + /// + string FFprobePath { get; } + + /// + /// --service + /// + bool IsService { get; } + + /// + /// --noautorunwebapp + /// + bool AutoRunWebApp { get; } + + /// + /// --package-name + /// + string PackageName { get; } + + /// + /// --restartpath + /// + string RestartPath { get; } + + /// + /// --restartargs + /// + string RestartArgs { get; } + } +} diff --git a/Emby.Server.Implementations/StartupOptions.cs b/Emby.Server.Implementations/StartupOptions.cs deleted file mode 100644 index f4bb94f74..000000000 --- a/Emby.Server.Implementations/StartupOptions.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace Emby.Server.Implementations -{ - using CommandLine; - - /// - /// Class used by CommandLine package when parsing the command line arguments. - /// - public class StartupOptions - { - [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (databases files etc.).")] - public string PathData { get; set; } - - [Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")] - public string PathConfig { get; set; } - - [Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")] - public string PathLog { get; set; } - - - [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg exe to use in place of built-in.")] - public string FFmpeg { get; set; } - - [Option("ffprobe", Required = false, HelpText = "ffmpeg and ffprobe switches must be supplied together.")] - public string FFprobe { get; set; } - - - [Option("service", Required = false, HelpText = "Run as headless service.")] - public bool Service { get; set; } - - [Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")] - public bool NoAutoRunWebApp { get; set; } - - [Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")] - public string PackageName { get; set; } - - - [Option("restartpath", Required = false, HelpText = "Path to reset script.")] - public string RestartPath { get; set; } - - [Option("restartargs", Required = false, HelpText = "Arguments for restart script.")] - public string RestartArgs { get; set; } - } - } diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index 5a4bf5149..1f72de86d 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -32,6 +32,7 @@ + diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 2f7edee65..905cf3aa0 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -6,8 +6,10 @@ using System.Net; using System.Net.Security; using System.Reflection; using System.Runtime.InteropServices; +using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using CommandLine; using Emby.Drawing; using Emby.Server.Implementations; using Emby.Server.Implementations.EnvironmentInfo; @@ -26,9 +28,6 @@ using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Jellyfin.Server { - using CommandLine; - using System.Text.RegularExpressions; - public static class Program { private static readonly CancellationTokenSource _tokenSource = new CancellationTokenSource(); @@ -41,8 +40,8 @@ namespace Jellyfin.Server // For backwards compatibility. // Modify any input arguments now which start with single-hyphen to POSIX standard // double-hyphen to allow parsing by CommandLineParser package. - var pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx - var substitution = @"-$1"; // Prepend with additional single-hyphen + const string pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx + const string substitution = @"-$1"; // Prepend with additional single-hyphen var regex = new Regex(pattern); for (var i = 0; i < args.Length; i++) @@ -152,9 +151,9 @@ namespace Jellyfin.Server string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH"); if (string.IsNullOrEmpty(programDataPath)) { - if (options.PathData != null) + if (options.DataDir != null) { - programDataPath = options.PathData; + programDataPath = options.DataDir; } else { @@ -190,9 +189,9 @@ namespace Jellyfin.Server string configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR"); if (string.IsNullOrEmpty(configDir)) { - if (options.PathConfig != null) + if (options.ConfigDir != null) { - configDir = options.PathConfig; + configDir = options.ConfigDir; } else { @@ -209,9 +208,9 @@ namespace Jellyfin.Server string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR"); if (string.IsNullOrEmpty(logDir)) { - if (options.PathLog != null) + if (options.LogDir != null) { - logDir = options.PathLog; + logDir = options.LogDir; } else { diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs new file mode 100644 index 000000000..97fcb633a --- /dev/null +++ b/Jellyfin.Server/StartupOptions.cs @@ -0,0 +1,47 @@ +using CommandLine; +using Emby.Server.Implementations.ParsedStartupOptions; + +namespace Jellyfin.Server +{ + /// + /// Class used by CommandLine package when parsing the command line arguments. + /// + public class StartupOptions : IStartupOptions + { + [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (databases files etc.).")] + public string DataDir { get; set; } + + [Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")] + public string ConfigDir { get; set; } + + [Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")] + public string LogDir { get; set; } + + [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg exe to use in place of built-in.")] + public string FFmpegPath { get; set; } + + [Option("ffprobe", Required = false, HelpText = "ffmpeg and ffprobe switches must be supplied together.")] + public string FFprobePath { get; set; } + + [Option("service", Required = false, HelpText = "Run as headless service.")] + public bool IsService { get; set; } + + [Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")] + public bool AutoRunWebApp { get => !NoautoRunWebApp; set => NoautoRunWebApp = value; } + + [Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")] + public string PackageName { get; set; } + + [Option("restartpath", Required = false, HelpText = "Path to reset script.")] + public string RestartPath { get; set; } + + [Option("restartargs", Required = false, HelpText = "Arguments for restart script.")] + public string RestartArgs { get; set; } + + /// + /// Gets or sets a value indicating whether to run not run the web app. + /// Command line switch is --noautorunwebapp, which we store privately here, but provide inverse (AutoRunWebApp) for users. + /// + private bool NoautoRunWebApp { get; set; } + } +} -- cgit v1.2.3 From 211ae30188546e9c652b68b609ab6266ab42a49d Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Mon, 28 Jan 2019 21:45:00 +0000 Subject: Revert back to NoAutoRunWebApp Addressed further review comments. Removed unnecessary .ParsedStartupOptions namespace. Removed DataDir, ConfigDir and LogDir from Interface file as not necessary. --- Emby.Server.Implementations/ApplicationHost.cs | 1 - .../EntryPoints/StartupWizard.cs | 2 +- Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs | 1 - Emby.Server.Implementations/IStartupOptions.cs | 19 ++----------------- Jellyfin.Server/StartupOptions.cs | 10 ++-------- 5 files changed, 5 insertions(+), 28 deletions(-) (limited to 'Emby.Server.Implementations/EntryPoints/StartupWizard.cs') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 3af9e487e..c3176bc9c 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -43,7 +43,6 @@ using Emby.Server.Implementations.ScheduledTasks; using Emby.Server.Implementations.Security; using Emby.Server.Implementations.Serialization; using Emby.Server.Implementations.Session; -using Emby.Server.Implementations.ParsedStartupOptions; using Emby.Server.Implementations.Threading; using Emby.Server.Implementations.TV; using Emby.Server.Implementations.Updates; diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index 43d18e135..bb96120f4 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints { var options = ((ApplicationHost)_appHost).StartupOptions; - if (options.AutoRunWebApp) + if (!options.NoAutoRunWebApp) { BrowserLauncher.OpenWebApp(_appHost); } diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs index b422b8862..6167d1eaa 100644 --- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs +++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs @@ -6,7 +6,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; using Microsoft.Extensions.Logging; -using Emby.Server.Implementations.ParsedStartupOptions; namespace Emby.Server.Implementations.FFMpeg { diff --git a/Emby.Server.Implementations/IStartupOptions.cs b/Emby.Server.Implementations/IStartupOptions.cs index 878bb6640..24aaa76c0 100644 --- a/Emby.Server.Implementations/IStartupOptions.cs +++ b/Emby.Server.Implementations/IStartupOptions.cs @@ -1,22 +1,7 @@ -namespace Emby.Server.Implementations.ParsedStartupOptions +namespace Emby.Server.Implementations { public interface IStartupOptions { - /// - /// --datadir - /// - string DataDir { get; } - - /// - /// --configdir - /// - string ConfigDir { get; } - - /// - /// --logdir - /// - string LogDir { get; } - /// /// --ffmpeg /// @@ -35,7 +20,7 @@ namespace Emby.Server.Implementations.ParsedStartupOptions /// /// --noautorunwebapp /// - bool AutoRunWebApp { get; } + bool NoAutoRunWebApp { get; } /// /// --package-name diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs index 97fcb633a..a1bdb756e 100644 --- a/Jellyfin.Server/StartupOptions.cs +++ b/Jellyfin.Server/StartupOptions.cs @@ -1,5 +1,5 @@ using CommandLine; -using Emby.Server.Implementations.ParsedStartupOptions; +using Emby.Server.Implementations; namespace Jellyfin.Server { @@ -27,7 +27,7 @@ namespace Jellyfin.Server public bool IsService { get; set; } [Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")] - public bool AutoRunWebApp { get => !NoautoRunWebApp; set => NoautoRunWebApp = value; } + public bool NoAutoRunWebApp { get; set; } [Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")] public string PackageName { get; set; } @@ -37,11 +37,5 @@ namespace Jellyfin.Server [Option("restartargs", Required = false, HelpText = "Arguments for restart script.")] public string RestartArgs { get; set; } - - /// - /// Gets or sets a value indicating whether to run not run the web app. - /// Command line switch is --noautorunwebapp, which we store privately here, but provide inverse (AutoRunWebApp) for users. - /// - private bool NoautoRunWebApp { get; set; } } } -- cgit v1.2.3