Rename More Sonarr References

pull/94/head
Qstick 7 years ago
parent f69559e4da
commit 5003cd8a14

@ -1,4 +1,4 @@
using System; using System;
using System.Data.SQLite; using System.Data.SQLite;
using FluentValidation; using FluentValidation;
using Nancy; using Nancy;
@ -10,11 +10,11 @@ using HttpStatusCode = Nancy.HttpStatusCode;
namespace Lidarr.Http.ErrorManagement namespace Lidarr.Http.ErrorManagement
{ {
public class SonarrErrorPipeline public class LidarrErrorPipeline
{ {
private readonly Logger _logger; private readonly Logger _logger;
public SonarrErrorPipeline(Logger logger) public LidarrErrorPipeline(Logger logger)
{ {
_logger = logger; _logger = logger;
} }
@ -76,4 +76,4 @@ namespace Lidarr.Http.ErrorManagement
}.AsResponse(HttpStatusCode.InternalServerError); }.AsResponse(HttpStatusCode.InternalServerError);
} }
} }
} }

@ -1,11 +1,11 @@
using System; using System;
using Nancy; using Nancy;
using Nancy.Bootstrapper; using Nancy.Bootstrapper;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
namespace Lidarr.Http.Extensions.Pipelines namespace Lidarr.Http.Extensions.Pipelines
{ {
public class SonarrVersionPipeline : IRegisterNancyPipeline public class LidarrVersionPipeline : IRegisterNancyPipeline
{ {
public int Order => 0; public int Order => 0;
@ -22,4 +22,4 @@ namespace Lidarr.Http.Extensions.Pipelines
} }
} }
} }
} }

@ -17,9 +17,9 @@ namespace NzbDrone.Api.Extensions.Pipelines
private static int _requestSequenceID; private static int _requestSequenceID;
private readonly SonarrErrorPipeline _errorPipeline; private readonly LidarrErrorPipeline _errorPipeline;
public RequestLoggingPipeline(SonarrErrorPipeline errorPipeline) public RequestLoggingPipeline(LidarrErrorPipeline errorPipeline)
{ {
_errorPipeline = errorPipeline; _errorPipeline = errorPipeline;
} }

@ -76,7 +76,7 @@
<Compile Include="ClientSchema\SelectOption.cs" /> <Compile Include="ClientSchema\SelectOption.cs" />
<Compile Include="ErrorManagement\ErrorHandler.cs" /> <Compile Include="ErrorManagement\ErrorHandler.cs" />
<Compile Include="ErrorManagement\ErrorModel.cs" /> <Compile Include="ErrorManagement\ErrorModel.cs" />
<Compile Include="ErrorManagement\SonarrErrorPipeline.cs" /> <Compile Include="ErrorManagement\LidarrErrorPipeline.cs" />
<Compile Include="Exceptions\InvalidApiKeyException.cs" /> <Compile Include="Exceptions\InvalidApiKeyException.cs" />
<Compile Include="Extensions\AccessControlHeaders.cs" /> <Compile Include="Extensions\AccessControlHeaders.cs" />
<Compile Include="Extensions\NancyJsonSerializer.cs" /> <Compile Include="Extensions\NancyJsonSerializer.cs" />
@ -86,7 +86,7 @@
<Compile Include="Extensions\Pipelines\IfModifiedPipeline.cs" /> <Compile Include="Extensions\Pipelines\IfModifiedPipeline.cs" />
<Compile Include="Extensions\Pipelines\IRegisterNancyPipeline.cs" /> <Compile Include="Extensions\Pipelines\IRegisterNancyPipeline.cs" />
<Compile Include="Extensions\Pipelines\RequestLoggingPipeline.cs" /> <Compile Include="Extensions\Pipelines\RequestLoggingPipeline.cs" />
<Compile Include="Extensions\Pipelines\SonarrVersionPipeline.cs" /> <Compile Include="Extensions\Pipelines\LidarrVersionPipeline.cs" />
<Compile Include="Extensions\ReqResExtensions.cs" /> <Compile Include="Extensions\ReqResExtensions.cs" />
<Compile Include="Extensions\RequestExtensions.cs" /> <Compile Include="Extensions\RequestExtensions.cs" />
<Compile Include="Frontend\CacheableSpecification.cs" /> <Compile Include="Frontend\CacheableSpecification.cs" />

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
@ -20,11 +20,11 @@ namespace NzbDrone.App.Test
.Returns(new ProcessInfo() { Id = CURRENT_PROCESS_ID }); .Returns(new ProcessInfo() { Id = CURRENT_PROCESS_ID });
Mocker.GetMock<IProcessProvider>() Mocker.GetMock<IProcessProvider>()
.Setup(s => s.FindProcessByName(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME)) .Setup(s => s.FindProcessByName(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME))
.Returns(new List<ProcessInfo>()); .Returns(new List<ProcessInfo>());
Mocker.GetMock<IProcessProvider>() Mocker.GetMock<IProcessProvider>()
.Setup(s => s.FindProcessByName(ProcessProvider.NZB_DRONE_PROCESS_NAME)) .Setup(s => s.FindProcessByName(ProcessProvider.LIDARR_PROCESS_NAME))
.Returns(new List<ProcessInfo>()); .Returns(new List<ProcessInfo>());
} }
@ -47,7 +47,7 @@ namespace NzbDrone.App.Test
public void should_enforce_if_another_console_is_running() public void should_enforce_if_another_console_is_running()
{ {
Mocker.GetMock<IProcessProvider>() Mocker.GetMock<IProcessProvider>()
.Setup(c => c.FindProcessByName(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME)) .Setup(c => c.FindProcessByName(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME))
.Returns(new List<ProcessInfo> .Returns(new List<ProcessInfo>
{ {
new ProcessInfo {Id = 10}, new ProcessInfo {Id = 10},
@ -63,7 +63,7 @@ namespace NzbDrone.App.Test
public void should_return_false_if_another_gui_is_running() public void should_return_false_if_another_gui_is_running()
{ {
Mocker.GetMock<IProcessProvider>() Mocker.GetMock<IProcessProvider>()
.Setup(c => c.FindProcessByName(ProcessProvider.NZB_DRONE_PROCESS_NAME)) .Setup(c => c.FindProcessByName(ProcessProvider.LIDARR_PROCESS_NAME))
.Returns(new List<ProcessInfo> .Returns(new List<ProcessInfo>
{ {
new ProcessInfo {Id = CURRENT_PROCESS_ID}, new ProcessInfo {Id = CURRENT_PROCESS_ID},

@ -1,4 +1,4 @@
using System.ServiceProcess; using System.ServiceProcess;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
@ -22,14 +22,14 @@ namespace NzbDrone.App.Test
public void Route_should_call_install_service_when_application_mode_is_install() public void Route_should_call_install_service_when_application_mode_is_install()
{ {
var serviceProviderMock = Mocker.GetMock<IServiceProvider>(MockBehavior.Strict); var serviceProviderMock = Mocker.GetMock<IServiceProvider>(MockBehavior.Strict);
serviceProviderMock.Setup(c => c.Install(ServiceProvider.NZBDRONE_SERVICE_NAME)); serviceProviderMock.Setup(c => c.Install(ServiceProvider.SERVICE_NAME));
serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(false); serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.SERVICE_NAME)).Returns(false);
serviceProviderMock.Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME)); serviceProviderMock.Setup(c => c.Start(ServiceProvider.SERVICE_NAME));
Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true); Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true);
Subject.Route(ApplicationModes.InstallService); Subject.Route(ApplicationModes.InstallService);
serviceProviderMock.Verify(c => c.Install(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once()); serviceProviderMock.Verify(c => c.Install(ServiceProvider.SERVICE_NAME), Times.Once());
} }
@ -37,13 +37,13 @@ namespace NzbDrone.App.Test
public void Route_should_call_uninstall_service_when_application_mode_is_uninstall() public void Route_should_call_uninstall_service_when_application_mode_is_uninstall()
{ {
var serviceProviderMock = Mocker.GetMock<IServiceProvider>(); var serviceProviderMock = Mocker.GetMock<IServiceProvider>();
serviceProviderMock.Setup(c => c.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME)); serviceProviderMock.Setup(c => c.UnInstall(ServiceProvider.SERVICE_NAME));
Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true); Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true);
serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(true); serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.SERVICE_NAME)).Returns(true);
Subject.Route(ApplicationModes.UninstallService); Subject.Route(ApplicationModes.UninstallService);
serviceProviderMock.Verify(c => c.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once()); serviceProviderMock.Verify(c => c.UnInstall(ServiceProvider.SERVICE_NAME), Times.Once());
} }
[Test] [Test]
@ -82,7 +82,7 @@ namespace NzbDrone.App.Test
Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true); Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true);
consoleMock.Setup(c => c.PrintServiceAlreadyExist()); consoleMock.Setup(c => c.PrintServiceAlreadyExist());
serviceMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(true); serviceMock.Setup(c => c.ServiceExist(ServiceProvider.SERVICE_NAME)).Returns(true);
Subject.Route(ApplicationModes.InstallService); Subject.Route(ApplicationModes.InstallService);
@ -96,7 +96,7 @@ namespace NzbDrone.App.Test
Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true); Mocker.GetMock<IRuntimeInfo>().SetupGet(c => c.IsUserInteractive).Returns(true);
consoleMock.Setup(c => c.PrintServiceDoesNotExist()); consoleMock.Setup(c => c.PrintServiceDoesNotExist());
serviceMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(false); serviceMock.Setup(c => c.ServiceExist(ServiceProvider.SERVICE_NAME)).Returns(false);
Subject.Route(ApplicationModes.UninstallService); Subject.Route(ApplicationModes.UninstallService);

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -257,7 +257,7 @@ namespace NzbDrone.Common.Test
[Test] [Test]
public void GetUpdateClientFolder() public void GetUpdateClientFolder()
{ {
GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr\NzbDrone.Update\".AsOsAgnostic()); GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr\Lidarr.Update\".AsOsAgnostic());
} }
[Test] [Test]

@ -76,8 +76,8 @@ namespace NzbDrone.Common.Test
[ManualTest] [ManualTest]
public void UnInstallService() public void UnInstallService()
{ {
Subject.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME); Subject.UnInstall(ServiceProvider.SERVICE_NAME);
Subject.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME).Should().BeFalse(); Subject.ServiceExist(ServiceProvider.SERVICE_NAME).Should().BeFalse();
} }
[Test] [Test]

@ -21,20 +21,20 @@ namespace NzbDrone.Common
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(" Usage: {0} <command> ", Process.GetCurrentProcess().MainModule.ModuleName); Console.WriteLine(" Usage: {0} <command> ", Process.GetCurrentProcess().MainModule.ModuleName);
Console.WriteLine(" Commands:"); Console.WriteLine(" Commands:");
Console.WriteLine(" /{0} Install the application as a Windows Service ({1}).", StartupContext.INSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME); Console.WriteLine(" /{0} Install the application as a Windows Service ({1}).", StartupContext.INSTALL_SERVICE, ServiceProvider.SERVICE_NAME);
Console.WriteLine(" /{0} Uninstall already installed Windows Service ({1}).", StartupContext.UNINSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME); Console.WriteLine(" /{0} Uninstall already installed Windows Service ({1}).", StartupContext.UNINSTALL_SERVICE, ServiceProvider.SERVICE_NAME);
Console.WriteLine(" /{0} Don't open Lidarr in a browser", StartupContext.NO_BROWSER); Console.WriteLine(" /{0} Don't open Lidarr in a browser", StartupContext.NO_BROWSER);
Console.WriteLine(" <No Arguments> Run application in console mode."); Console.WriteLine(" <No Arguments> Run application in console mode.");
} }
public void PrintServiceAlreadyExist() public void PrintServiceAlreadyExist()
{ {
Console.WriteLine("A service with the same name ({0}) already exists. Aborting installation", ServiceProvider.NZBDRONE_SERVICE_NAME); Console.WriteLine("A service with the same name ({0}) already exists. Aborting installation", ServiceProvider.SERVICE_NAME);
} }
public void PrintServiceDoesNotExist() public void PrintServiceDoesNotExist()
{ {
Console.WriteLine("Can't find service ({0})", ServiceProvider.NZBDRONE_SERVICE_NAME); Console.WriteLine("Can't find service ({0})", ServiceProvider.SERVICE_NAME);
} }
} }
} }

@ -21,8 +21,8 @@ namespace NzbDrone.Common.EnvironmentInfo
IsWindowsService = !IsUserInteractive && IsWindowsService = !IsUserInteractive &&
OsInfo.IsWindows && OsInfo.IsWindows &&
serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) && serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) &&
serviceProvider.GetStatus(ServiceProvider.NZBDRONE_SERVICE_NAME) == ServiceControllerStatus.StartPending; serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending;
//Guarded to avoid issues when running in a non-managed process //Guarded to avoid issues when running in a non-managed process
var entry = Assembly.GetEntryAssembly(); var entry = Assembly.GetEntryAssembly();
@ -77,7 +77,7 @@ namespace NzbDrone.Common.EnvironmentInfo
{ {
if (OsInfo.IsWindows) if (OsInfo.IsWindows)
{ {
return IsUserInteractive && Process.GetCurrentProcess().ProcessName.Equals(ProcessProvider.NZB_DRONE_PROCESS_NAME, StringComparison.InvariantCultureIgnoreCase); return IsUserInteractive && Process.GetCurrentProcess().ProcessName.Equals(ProcessProvider.LIDARR_PROCESS_NAME, StringComparison.InvariantCultureIgnoreCase);
} }
return false; return false;

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -11,8 +11,8 @@ namespace NzbDrone.Common.Extensions
public static class PathExtensions public static class PathExtensions
{ {
private const string APP_CONFIG_FILE = "config.xml"; private const string APP_CONFIG_FILE = "config.xml";
private const string NZBDRONE_DB = "lidarr.db"; private const string DB = "lidarr.db";
private const string NZBDRONE_LOG_DB = "logs.db"; private const string LOG_DB = "logs.db";
private const string NLOG_CONFIG_FILE = "nlog.config"; private const string NLOG_CONFIG_FILE = "nlog.config";
private const string UPDATE_CLIENT_EXE = "Lidarr.Update.exe"; private const string UPDATE_CLIENT_EXE = "Lidarr.Update.exe";
private const string BACKUP_FOLDER = "Backups"; private const string BACKUP_FOLDER = "Backups";
@ -21,7 +21,7 @@ namespace NzbDrone.Common.Extensions
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "Lidarr" + Path.DirectorySeparatorChar; private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "Lidarr" + Path.DirectorySeparatorChar;
private static readonly string UPDATE_BACKUP_FOLDER_NAME = "lidarr_backup" + Path.DirectorySeparatorChar; private static readonly string UPDATE_BACKUP_FOLDER_NAME = "lidarr_backup" + Path.DirectorySeparatorChar;
private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "lidarr_appdata_backup" + Path.DirectorySeparatorChar; private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "lidarr_appdata_backup" + Path.DirectorySeparatorChar;
private static readonly string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update" + Path.DirectorySeparatorChar; private static readonly string UPDATE_CLIENT_FOLDER_NAME = "Lidarr.Update" + Path.DirectorySeparatorChar;
private static readonly string UPDATE_LOG_FOLDER_NAME = "UpdateLogs" + Path.DirectorySeparatorChar; private static readonly string UPDATE_LOG_FOLDER_NAME = "UpdateLogs" + Path.DirectorySeparatorChar;
public static string CleanFilePath(this string path) public static string CleanFilePath(this string path)
@ -238,7 +238,7 @@ namespace NzbDrone.Common.Extensions
public static string GetUpdateBackupDatabase(this IAppFolderInfo appFolderInfo) public static string GetUpdateBackupDatabase(this IAppFolderInfo appFolderInfo)
{ {
return Path.Combine(GetUpdateBackUpAppDataFolder(appFolderInfo), NZBDRONE_DB); return Path.Combine(GetUpdateBackUpAppDataFolder(appFolderInfo), DB);
} }
public static string GetUpdatePackageFolder(this IAppFolderInfo appFolderInfo) public static string GetUpdatePackageFolder(this IAppFolderInfo appFolderInfo)
@ -261,14 +261,14 @@ namespace NzbDrone.Common.Extensions
return Path.Combine(GetAppDataPath(appFolderInfo), BACKUP_FOLDER); return Path.Combine(GetAppDataPath(appFolderInfo), BACKUP_FOLDER);
} }
public static string GetNzbDroneDatabase(this IAppFolderInfo appFolderInfo) public static string GetDatabase(this IAppFolderInfo appFolderInfo)
{ {
return Path.Combine(GetAppDataPath(appFolderInfo), NZBDRONE_DB); return Path.Combine(GetAppDataPath(appFolderInfo), DB);
} }
public static string GetLogDatabase(this IAppFolderInfo appFolderInfo) public static string GetLogDatabase(this IAppFolderInfo appFolderInfo)
{ {
return Path.Combine(GetAppDataPath(appFolderInfo), NZBDRONE_LOG_DB); return Path.Combine(GetAppDataPath(appFolderInfo), LOG_DB);
} }
public static string GetNlogConfigPath(this IAppFolderInfo appFolderInfo) public static string GetNlogConfigPath(this IAppFolderInfo appFolderInfo)
@ -276,4 +276,4 @@ namespace NzbDrone.Common.Extensions
return Path.Combine(appFolderInfo.StartUpFolder, NLOG_CONFIG_FILE); return Path.Combine(appFolderInfo.StartUpFolder, NLOG_CONFIG_FILE);
} }
} }
} }

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
@ -30,7 +30,7 @@ namespace NzbDrone.Common.Processes
return; return;
} }
var filename = Path.Combine(_appFolderInfo.AppDataFolder, "nzbdrone.pid"); var filename = Path.Combine(_appFolderInfo.AppDataFolder, "lidarr.pid");
try try
{ {
File.WriteAllText(filename, _processProvider.GetCurrentProcessId().ToString()); File.WriteAllText(filename, _processProvider.GetCurrentProcessId().ToString());

@ -35,8 +35,8 @@ namespace NzbDrone.Common.Processes
{ {
private readonly Logger _logger; private readonly Logger _logger;
public const string NZB_DRONE_PROCESS_NAME = "Lidarr"; public const string LIDARR_PROCESS_NAME = "Lidarr";
public const string NZB_DRONE_CONSOLE_PROCESS_NAME = "Lidarr.Console"; public const string LIDARR_CONSOLE_PROCESS_NAME = "Lidarr.Console";
public ProcessProvider(Logger logger) public ProcessProvider(Logger logger)
{ {

@ -25,7 +25,7 @@ namespace NzbDrone.Common
public class ServiceProvider : IServiceProvider public class ServiceProvider : IServiceProvider
{ {
public const string NZBDRONE_SERVICE_NAME = "Lidarr"; public const string SERVICE_NAME = "Lidarr";
private readonly IProcessProvider _processProvider; private readonly IProcessProvider _processProvider;
private readonly Logger _logger; private readonly Logger _logger;

@ -115,7 +115,7 @@ namespace NzbDrone.Core.Backup
{ {
unitOfWork.BeginTransaction(IsolationLevel.Serializable); unitOfWork.BeginTransaction(IsolationLevel.Serializable);
var databaseFile = _appFolderInfo.GetNzbDroneDatabase(); var databaseFile = _appFolderInfo.GetDatabase();
var tempDatabaseFile = Path.Combine(_backupTempFolder, Path.GetFileName(databaseFile)); var tempDatabaseFile = Path.Combine(_backupTempFolder, Path.GetFileName(databaseFile));
_diskTransferService.TransferFile(databaseFile, tempDatabaseFile, TransferMode.Copy); _diskTransferService.TransferFile(databaseFile, tempDatabaseFile, TransferMode.Copy);

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Datastore
{ {
public ConnectionStringFactory(IAppFolderInfo appFolderInfo) public ConnectionStringFactory(IAppFolderInfo appFolderInfo)
{ {
MainDbConnectionString = GetConnectionString(appFolderInfo.GetNzbDroneDatabase()); MainDbConnectionString = GetConnectionString(appFolderInfo.GetDatabase());
LogDbConnectionString = GetConnectionString(appFolderInfo.GetLogDatabase()); LogDbConnectionString = GetConnectionString(appFolderInfo.GetLogDatabase());
} }

@ -40,7 +40,7 @@ namespace NzbDrone.Core.Lifecycle
if (_runtimeInfo.IsWindowsService) if (_runtimeInfo.IsWindowsService)
{ {
_serviceProvider.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Stop(ServiceProvider.SERVICE_NAME);
} }
} }
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Lifecycle
if (_runtimeInfo.IsWindowsService) if (_runtimeInfo.IsWindowsService)
{ {
_serviceProvider.Restart(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Restart(ServiceProvider.SERVICE_NAME);
} }
} }

@ -41,27 +41,27 @@ namespace NzbDrone.Host
case ApplicationModes.InstallService: case ApplicationModes.InstallService:
{ {
_logger.Debug("Install Service selected"); _logger.Debug("Install Service selected");
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)) if (_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME))
{ {
_consoleService.PrintServiceAlreadyExist(); _consoleService.PrintServiceAlreadyExist();
} }
else else
{ {
_serviceProvider.Install(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Install(ServiceProvider.SERVICE_NAME);
_serviceProvider.Start(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Start(ServiceProvider.SERVICE_NAME);
} }
break; break;
} }
case ApplicationModes.UninstallService: case ApplicationModes.UninstallService:
{ {
_logger.Debug("Uninstall Service selected"); _logger.Debug("Uninstall Service selected");
if (!_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)) if (!_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME))
{ {
_consoleService.PrintServiceDoesNotExist(); _consoleService.PrintServiceDoesNotExist();
} }
else else
{ {
_serviceProvider.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.UnInstall(ServiceProvider.SERVICE_NAME);
} }
break; break;

@ -56,8 +56,8 @@ namespace NzbDrone.Host
{ {
var currentId = _processProvider.GetCurrentProcess().Id; var currentId = _processProvider.GetCurrentProcess().Id;
var otherProcesses = _processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME) var otherProcesses = _processProvider.FindProcessByName(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME)
.Union(_processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_PROCESS_NAME)) .Union(_processProvider.FindProcessByName(ProcessProvider.LIDARR_PROCESS_NAME))
.Select(c => c.Id) .Select(c => c.Id)
.Except(new[] { currentId }) .Except(new[] { currentId })
.ToList(); .ToList();

@ -1,4 +1,4 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@ -32,12 +32,7 @@ namespace NzbDrone.Test.Common
{ {
AppData = Path.Combine(TestContext.CurrentContext.TestDirectory, "_intg_" + DateTime.Now.Ticks); AppData = Path.Combine(TestContext.CurrentContext.TestDirectory, "_intg_" + DateTime.Now.Ticks);
var nzbdroneConsoleExe = "Lidarr.Console.exe"; var lidarrConsoleExe = OsInfo.IsWindows ? "Lidarr.Console.exe" : "Lidarr.exe";
if (OsInfo.IsNotWindows)
{
nzbdroneConsoleExe = "Lidarr.exe";
}
if (BuildInfo.IsDebug) if (BuildInfo.IsDebug)
{ {
@ -45,7 +40,7 @@ namespace NzbDrone.Test.Common
} }
else else
{ {
Start(Path.Combine("bin", nzbdroneConsoleExe)); Start(Path.Combine("bin", lidarrConsoleExe));
} }
while (true) while (true)
@ -84,8 +79,8 @@ namespace NzbDrone.Test.Common
_processProvider.Kill(_nzbDroneProcess.Id); _processProvider.Kill(_nzbDroneProcess.Id);
} }
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_PROCESS_NAME);
} }
private void Start(string outputNzbdroneConsoleExe) private void Start(string outputNzbdroneConsoleExe)
@ -134,4 +129,4 @@ namespace NzbDrone.Test.Common
} }
} }
} }
} }

@ -1,4 +1,4 @@
using System; using System;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
@ -34,7 +34,7 @@ namespace NzbDrone.Update.Test
[Test] [Test]
public void should_call_update_with_correct_path() public void should_call_update_with_correct_path()
{ {
var ProcessPath = @"C:\NzbDrone\lidarr.exe".AsOsAgnostic(); var ProcessPath = @"C:\Lidarr\lidarr.exe".AsOsAgnostic();
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(12)) Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(12))
.Returns(new ProcessInfo() { StartPath = ProcessPath }); .Returns(new ProcessInfo() { StartPath = ProcessPath });
@ -43,7 +43,7 @@ namespace NzbDrone.Update.Test
Subject.Start(new[] { "12", "", ProcessPath }); Subject.Start(new[] { "12", "", ProcessPath });
Mocker.GetMock<IInstallUpdateService>().Verify(c => c.Start(@"C:\NzbDrone".AsOsAgnostic(), 12), Times.Once()); Mocker.GetMock<IInstallUpdateService>().Verify(c => c.Start(@"C:\Lidarr".AsOsAgnostic(), 12), Times.Once());
} }

@ -1,4 +1,4 @@
using System; using System;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
@ -16,23 +16,23 @@ namespace NzbDrone.Update.Test
[Test] [Test]
public void should_start_service_if_app_type_was_serivce() public void should_start_service_if_app_type_was_serivce()
{ {
const string targetFolder = "c:\\NzbDrone\\"; const string targetFolder = "c:\\Lidarr\\";
Subject.Start(AppType.Service, targetFolder); Subject.Start(AppType.Service, targetFolder);
Mocker.GetMock<IServiceProvider>().Verify(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once()); Mocker.GetMock<IServiceProvider>().Verify(c => c.Start(ServiceProvider.SERVICE_NAME), Times.Once());
} }
[Test] [Test]
public void should_start_console_if_app_type_was_service_but_start_failed_because_of_permissions() public void should_start_console_if_app_type_was_service_but_start_failed_because_of_permissions()
{ {
const string targetFolder = "c:\\NzbDrone\\"; const string targetFolder = "c:\\Lidarr\\";
Mocker.GetMock<IServiceProvider>().Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME)).Throws(new InvalidOperationException()); Mocker.GetMock<IServiceProvider>().Setup(c => c.Start(ServiceProvider.SERVICE_NAME)).Throws(new InvalidOperationException());
Subject.Start(AppType.Service, targetFolder); Subject.Start(AppType.Service, targetFolder);
Mocker.GetMock<IProcessProvider>().Verify(c => c.SpawnNewProcess("c:\\NzbDrone\\Lidarr.Console.exe", "/" + StartupContext.NO_BROWSER, null), Times.Once()); Mocker.GetMock<IProcessProvider>().Verify(c => c.SpawnNewProcess("c:\\Lidarr\\Lidarr.Console.exe", "/" + StartupContext.NO_BROWSER, null), Times.Once());
ExceptionVerification.ExpectedWarns(1); ExceptionVerification.ExpectedWarns(1);
} }

@ -9,7 +9,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NzbDrone.Update</RootNamespace> <RootNamespace>NzbDrone.Update</RootNamespace>
<AssemblyName>NzbDrone.Update</AssemblyName> <AssemblyName>Lidarr.Update</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
@ -22,7 +22,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\..\_output\NzbDrone.Update\</OutputPath> <OutputPath>..\..\_output\Lidarr.Update\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -32,7 +32,7 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\..\_output\NzbDrone.Update\</OutputPath> <OutputPath>..\..\_output\Lidarr.Update\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

@ -47,7 +47,7 @@ namespace NzbDrone.Update.UpdateEngine
try try
{ {
_diskTransferService.TransferFile(_appFolderInfo.GetConfigPath(), _appFolderInfo.GetUpdateBackupConfigFile(), TransferMode.Copy); _diskTransferService.TransferFile(_appFolderInfo.GetConfigPath(), _appFolderInfo.GetUpdateBackupConfigFile(), TransferMode.Copy);
_diskTransferService.TransferFile(_appFolderInfo.GetNzbDroneDatabase(), _appFolderInfo.GetUpdateBackupDatabase(), TransferMode.Copy); _diskTransferService.TransferFile(_appFolderInfo.GetDatabase(), _appFolderInfo.GetUpdateBackupDatabase(), TransferMode.Copy);
} }
catch (Exception e) catch (Exception e)
{ {

@ -28,13 +28,13 @@ namespace NzbDrone.Update.UpdateEngine
return AppType.Normal; return AppType.Normal;
} }
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) if (_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)
&& _serviceProvider.IsServiceRunning(ServiceProvider.NZBDRONE_SERVICE_NAME)) && _serviceProvider.IsServiceRunning(ServiceProvider.SERVICE_NAME))
{ {
return AppType.Service; return AppType.Service;
} }
if (_processProvider.Exists(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME)) if (_processProvider.Exists(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME))
{ {
return AppType.Console; return AppType.Console;
} }

@ -22,7 +22,7 @@ namespace NzbDrone.Update.UpdateEngine
{ {
try try
{ {
var targetExecutable = Path.Combine(targetFolder, "NzbDrone.exe"); var targetExecutable = Path.Combine(targetFolder, "Lidarr.exe");
if (File.Exists(targetExecutable)) if (File.Exists(targetExecutable))
{ {

@ -86,8 +86,8 @@ namespace NzbDrone.Update.UpdateEngine
var appType = _detectApplicationType.GetAppType(); var appType = _detectApplicationType.GetAppType();
_processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME); _processProvider.FindProcessByName(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME);
_processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_PROCESS_NAME); _processProvider.FindProcessByName(ProcessProvider.LIDARR_PROCESS_NAME);
if (OsInfo.IsWindows) if (OsInfo.IsWindows)
{ {
@ -101,7 +101,7 @@ namespace NzbDrone.Update.UpdateEngine
if (OsInfo.IsWindows) if (OsInfo.IsWindows)
{ {
if (_processProvider.Exists(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME) || _processProvider.Exists(ProcessProvider.NZB_DRONE_PROCESS_NAME)) if (_processProvider.Exists(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME) || _processProvider.Exists(ProcessProvider.LIDARR_PROCESS_NAME))
{ {
_logger.Error("Lidarr was restarted prematurely by external process."); _logger.Error("Lidarr was restarted prematurely by external process.");
return; return;
@ -141,14 +141,14 @@ namespace NzbDrone.Update.UpdateEngine
{ {
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
if (_processProvider.Exists(ProcessProvider.NZB_DRONE_PROCESS_NAME)) if (_processProvider.Exists(ProcessProvider.LIDARR_PROCESS_NAME))
{ {
_logger.Info("Lidarr was restarted by external process."); _logger.Info("Lidarr was restarted by external process.");
break; break;
} }
} }
if (!_processProvider.Exists(ProcessProvider.NZB_DRONE_PROCESS_NAME)) if (!_processProvider.Exists(ProcessProvider.LIDARR_PROCESS_NAME))
{ {
_startNzbDrone.Start(appType, installationFolder); _startNzbDrone.Start(appType, installationFolder);
} }

@ -57,7 +57,7 @@ namespace NzbDrone.Update.UpdateEngine
private void StartService() private void StartService()
{ {
_logger.Info("Starting Lidarr service"); _logger.Info("Starting Lidarr service");
_serviceProvider.Start(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Start(ServiceProvider.SERVICE_NAME);
} }
private void StartWinform(string installationFolder) private void StartWinform(string installationFolder)

@ -31,13 +31,13 @@ namespace NzbDrone.Update.UpdateEngine
{ {
_logger.Info("Stopping all running services"); _logger.Info("Stopping all running services");
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) if (_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)
&& _serviceProvider.IsServiceRunning(ServiceProvider.NZBDRONE_SERVICE_NAME)) && _serviceProvider.IsServiceRunning(ServiceProvider.SERVICE_NAME))
{ {
try try
{ {
_logger.Info("NzbDrone Service is installed and running"); _logger.Info("NzbDrone Service is installed and running");
_serviceProvider.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME); _serviceProvider.Stop(ServiceProvider.SERVICE_NAME);
} }
catch (Exception e) catch (Exception e)
{ {
@ -47,15 +47,15 @@ namespace NzbDrone.Update.UpdateEngine
_logger.Info("Killing all running processes"); _logger.Info("Killing all running processes");
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_PROCESS_NAME);
} }
else else
{ {
_logger.Info("Killing all running processes"); _logger.Info("Killing all running processes");
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.LIDARR_PROCESS_NAME);
_processProvider.Kill(processId); _processProvider.Kill(processId);
} }

@ -1,4 +1,4 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@ -8,7 +8,7 @@ namespace ServiceInstall
{ {
public static class ServiceHelper public static class ServiceHelper
{ {
private static string NzbDroneExe => Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "Lidarr.Console.exe"); private static string LidarrExe => Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "Lidarr.Console.exe");
private static bool IsAnAdministrator() private static bool IsAnAdministrator()
{ {
@ -18,7 +18,7 @@ namespace ServiceInstall
public static void Run(string arg) public static void Run(string arg)
{ {
if (!File.Exists(NzbDroneExe)) if (!File.Exists(LidarrExe))
{ {
Console.WriteLine("Unable to find Lidarr.Console.exe in the current directory."); Console.WriteLine("Unable to find Lidarr.Console.exe in the current directory.");
return; return;
@ -32,7 +32,7 @@ namespace ServiceInstall
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
FileName = NzbDroneExe, FileName = LidarrExe,
Arguments = arg, Arguments = arg,
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
@ -59,4 +59,4 @@ namespace ServiceInstall
} }
} }
} }

@ -1,4 +1,4 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@ -8,7 +8,7 @@ namespace ServiceUninstall
{ {
public static class ServiceHelper public static class ServiceHelper
{ {
private static string NzbDroneExe => Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "Lidarr.Console.exe"); private static string LidarrExe => Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "Lidarr.Console.exe");
private static bool IsAnAdministrator() private static bool IsAnAdministrator()
{ {
@ -18,7 +18,7 @@ namespace ServiceUninstall
public static void Run(string arg) public static void Run(string arg)
{ {
if (!File.Exists(NzbDroneExe)) if (!File.Exists(LidarrExe))
{ {
Console.WriteLine("Unable to find Lidarr.exe in the current directory."); Console.WriteLine("Unable to find Lidarr.exe in the current directory.");
return; return;
@ -32,7 +32,7 @@ namespace ServiceUninstall
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
FileName = NzbDroneExe, FileName = LidarrExe,
Arguments = arg, Arguments = arg,
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
@ -59,4 +59,4 @@ namespace ServiceUninstall
} }
} }
} }

Loading…
Cancel
Save