mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
NzbDrone Update no longer opens console/browser.
This commit is contained in:
+2
-2
@@ -49,10 +49,10 @@ namespace NzbDrone
|
||||
return;
|
||||
}
|
||||
|
||||
var container = MainAppContainerBuilder.BuildContainer();
|
||||
var container = MainAppContainerBuilder.BuildContainer(args);
|
||||
|
||||
DbFactory.RegisterDatabase(container);
|
||||
container.Resolve<Router>().Route(args);
|
||||
container.Resolve<Router>().Route();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -22,12 +22,13 @@ namespace NzbDrone
|
||||
private readonly IHostController _hostController;
|
||||
private readonly IProcessProvider _processProvider;
|
||||
private readonly PriorityMonitor _priorityMonitor;
|
||||
private readonly StartupArguments _startupArguments;
|
||||
private readonly IFirewallAdapter _firewallAdapter;
|
||||
private readonly IUrlAclAdapter _urlAclAdapter;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public NzbDroneServiceFactory(IConfigFileProvider configFileProvider, IHostController hostController, IRuntimeInfo runtimeInfo,
|
||||
IProcessProvider processProvider, PriorityMonitor priorityMonitor,
|
||||
IProcessProvider processProvider, PriorityMonitor priorityMonitor, StartupArguments startupArguments,
|
||||
IFirewallAdapter firewallAdapter, IUrlAclAdapter urlAclAdapter, Logger logger)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
@@ -35,6 +36,7 @@ namespace NzbDrone
|
||||
_runtimeInfo = runtimeInfo;
|
||||
_processProvider = processProvider;
|
||||
_priorityMonitor = priorityMonitor;
|
||||
_startupArguments = startupArguments;
|
||||
_firewallAdapter = firewallAdapter;
|
||||
_urlAclAdapter = urlAclAdapter;
|
||||
_logger = logger;
|
||||
@@ -55,7 +57,9 @@ namespace NzbDrone
|
||||
}
|
||||
_hostController.StartServer();
|
||||
|
||||
if (_runtimeInfo.IsUserInteractive && _configFileProvider.LaunchBrowser)
|
||||
if (!_startupArguments.Flags.Contains(StartupArguments.NO_BROWSER) &&
|
||||
_runtimeInfo.IsUserInteractive &&
|
||||
_configFileProvider.LaunchBrowser)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using NLog;
|
||||
using Nancy.Bootstrapper;
|
||||
using Nancy.Bootstrapper;
|
||||
using NzbDrone.Api;
|
||||
using NzbDrone.Api.SignalR;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
@@ -13,15 +11,12 @@ namespace NzbDrone
|
||||
{
|
||||
public class MainAppContainerBuilder : ContainerBuilderBase
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetLogger("ContainerBuilderBase");
|
||||
|
||||
public static IContainer BuildContainer()
|
||||
public static IContainer BuildContainer(string[] args)
|
||||
{
|
||||
return new MainAppContainerBuilder().Container;
|
||||
return new MainAppContainerBuilder(args).Container;
|
||||
}
|
||||
|
||||
|
||||
private MainAppContainerBuilder()
|
||||
private MainAppContainerBuilder(string[] args)
|
||||
: base("NzbDrone", "NzbDrone.Common", "NzbDrone.Core", "NzbDrone.Api")
|
||||
{
|
||||
AutoRegisterImplementations<NzbDronePersistentConnection>();
|
||||
@@ -30,9 +25,8 @@ namespace NzbDrone
|
||||
Container.Register(typeof(IBasicRepository<NamingConfig>), typeof(BasicRepository<NamingConfig>));
|
||||
|
||||
Container.Register<INancyBootstrapper, NancyBootstrapper>();
|
||||
|
||||
|
||||
Container.Register(new StartupArguments(args));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+21
-15
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.SysTray;
|
||||
using IServiceProvider = NzbDrone.Common.IServiceProvider;
|
||||
@@ -14,25 +13,28 @@ namespace NzbDrone
|
||||
{
|
||||
private readonly INzbDroneServiceFactory _nzbDroneServiceFactory;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly StartupArguments _startupArguments;
|
||||
private readonly IConsoleService _consoleService;
|
||||
private readonly IRuntimeInfo _runtimeInfo;
|
||||
private readonly ISystemTrayApp _systemTrayProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
|
||||
public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider, StartupArguments startupArguments,
|
||||
IConsoleService consoleService, IRuntimeInfo runtimeInfo, ISystemTrayApp systemTrayProvider, Logger logger)
|
||||
{
|
||||
_nzbDroneServiceFactory = nzbDroneServiceFactory;
|
||||
_serviceProvider = serviceProvider;
|
||||
_startupArguments = startupArguments;
|
||||
_consoleService = consoleService;
|
||||
_runtimeInfo = runtimeInfo;
|
||||
_systemTrayProvider = systemTrayProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Route(IEnumerable<string> args)
|
||||
public void Route()
|
||||
{
|
||||
Route(GetApplicationMode(args));
|
||||
var appMode = GetApplicationMode();
|
||||
Route(appMode);
|
||||
}
|
||||
|
||||
public void Route(ApplicationModes applicationModes)
|
||||
@@ -87,7 +89,7 @@ namespace NzbDrone
|
||||
_logger.Trace("Uninstall Service selected");
|
||||
if (!_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
||||
{
|
||||
_consoleService.PrintServiceDoestExist();
|
||||
_consoleService.PrintServiceDoesNotExist();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,20 +106,24 @@ namespace NzbDrone
|
||||
}
|
||||
}
|
||||
|
||||
public static ApplicationModes GetApplicationMode(IEnumerable<string> args)
|
||||
private ApplicationModes GetApplicationMode()
|
||||
{
|
||||
if (args == null) return ApplicationModes.Console;
|
||||
if (_startupArguments.Flags.Contains(StartupArguments.HELP))
|
||||
{
|
||||
return ApplicationModes.Help;
|
||||
}
|
||||
|
||||
var cleanArgs = args.Where(c => c != null && !String.IsNullOrWhiteSpace(c)).ToList();
|
||||
if (cleanArgs.Count == 0) return ApplicationModes.Console;
|
||||
if (cleanArgs.Count != 1) return ApplicationModes.Help;
|
||||
if (_startupArguments.Flags.Contains(StartupArguments.INSTALL_SERVICE))
|
||||
{
|
||||
return ApplicationModes.InstallService;
|
||||
}
|
||||
|
||||
var arg = cleanArgs.First().Trim('/', '\\', '-').ToLower();
|
||||
if (_startupArguments.Flags.Contains(StartupArguments.UNINSTALL_SERVICE))
|
||||
{
|
||||
return ApplicationModes.UninstallService;
|
||||
}
|
||||
|
||||
if (arg == "i") return ApplicationModes.InstallService;
|
||||
if (arg == "u") return ApplicationModes.UninstallService;
|
||||
|
||||
return ApplicationModes.Help;
|
||||
return ApplicationModes.Console;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user