diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs index ade6278e3..0f63c09fa 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs @@ -1,6 +1,8 @@ -using NUnit.Framework; +using Moq; +using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class AppDataLocationFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_warning_when_app_data_is_child_of_startup_folder() { diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs index e95c03f65..96da3ecac 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using Moq; using NUnit.Framework; using NzbDrone.Core.Download; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -10,12 +12,20 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class DownloadClientCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_warning_when_download_client_has_not_been_configured() { Mocker.GetMock() .Setup(s => s.GetDownloadClients()) - .Returns(new IDownloadClient[0]); + .Returns(Array.Empty()); Subject.Check().ShouldBeWarning(); } diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs index 24b697a17..54dcf0f2f 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs @@ -31,6 +31,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [SetUp] public void Setup() { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + _clientStatus = new DownloadClientInfo { IsLocalhost = true, @@ -44,10 +48,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks _downloadClient.Setup(s => s.GetStatus()) .Returns(_clientStatus); - Mocker.GetMock() - .Setup(s => s.GetLocalizedString(It.IsAny())) - .Returns("Some Warning Message"); - Mocker.GetMock() .Setup(s => s.GetDownloadClients()) .Returns(new IDownloadClient[] { _downloadClient.Object }); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/HealthCheckFixtureExtensions.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/HealthCheckFixtureExtensions.cs index 5bb888db1..b62450de1 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/HealthCheckFixtureExtensions.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/HealthCheckFixtureExtensions.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using FluentAssertions; using NzbDrone.Common.Extensions; using NzbDrone.Core.HealthCheck; @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks if (wikiFragment.IsNotNullOrWhiteSpace()) { - result.WikiUrl.Fragment.Should().Be(wikiFragment); + result.WikiUrl.ToString().Should().Contain(wikiFragment); } } @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks if (wikiFragment.IsNotNullOrWhiteSpace()) { - result.WikiUrl.Fragment.Should().Be(wikiFragment); + result.WikiUrl.ToString().Should().Contain(wikiFragment); } } } diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportListStatusCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportListStatusCheckFixture.cs index e0110c2ae..19c464e77 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportListStatusCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportListStatusCheckFixture.cs @@ -4,6 +4,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.ImportLists; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(v => v.GetBlockedProviders()) .Returns(_blockedImportLists); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private Mock GivenImportList(int i, double backoffHours, double failureHours) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs index f243fbf56..e2276f51a 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs @@ -1,6 +1,8 @@ +using Moq; using NUnit.Framework; using NzbDrone.Core.Configuration; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class ImportMechanismCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenCompletedDownloadHandling(bool? enabled = null) { if (enabled.HasValue) @@ -19,7 +29,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_warning_when_completeddownloadhandling_false() + public void should_return_warning_when_completed_download_handling_not_configured() { GivenCompletedDownloadHandling(false); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerLongTermStatusCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerLongTermStatusCheckFixture.cs index 0cdba766a..deb9ff588 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerLongTermStatusCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerLongTermStatusCheckFixture.cs @@ -4,6 +4,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(v => v.GetBlockedProviders()) .Returns(_blockedIndexers); + + Mocker.GetMock() + .Setup(v => v.GetLocalizedString(It.IsAny())) + .Returns("Error"); } private Mock GivenIndexer(int id, double backoffHours, double failureHours) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs index 28d314005..e2bcec417 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -22,6 +23,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(s => s.RssEnabled(It.IsAny())) .Returns(new List()); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenIndexer(bool supportsRss, bool supportsSearch) @@ -47,6 +52,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(s => s.RssEnabled(false)) .Returns(new List { _indexerMock.Object }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("recent indexer errors"); } [Test] diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs index 030d8a8db..e0bf60922 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs @@ -3,6 +3,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -26,6 +27,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(s => s.InteractiveSearchEnabled(It.IsAny())) .Returns(new List()); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenIndexer(bool supportsRss, bool supportsSearch) @@ -62,6 +67,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(s => s.InteractiveSearchEnabled(false)) .Returns(new List { _indexerMock.Object }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("recent indexer errors"); } [Test] diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs index 1ffac51c3..ed54dc0f7 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs @@ -4,6 +4,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(v => v.GetBlockedProviders()) .Returns(_blockedIndexers); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private Mock GivenIndexer(int i, double backoffHours, double failureHours) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs index 1bf02cc08..ce1c2575a 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs @@ -10,7 +10,7 @@ using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; using NzbDrone.Core.Download.Clients; using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Parser.Model; @@ -41,12 +41,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks { _downloadItem = new DownloadClientItem { - DownloadClientInfo = new DownloadClientItemClientInfo - { - Protocol = DownloadProtocol.Usenet, - Id = 1, - Name = "Test" - }, + DownloadClientInfo = new DownloadClientItemClientInfo { Name = "Test" }, DownloadId = "TestId", OutputPath = new OsPath(_downloadItemPath) }; @@ -94,6 +89,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Ensure.That(path, () => path).IsValidPath(); return false; }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenFolderExists(string folder) @@ -178,30 +177,30 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_ok_on_track_imported_event() + public void should_return_ok_on_book_imported_event() { GivenFolderExists(_downloadRootPath); - var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List(), true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() }); + var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List(), true, _downloadItem); Subject.Check(importEvent).ShouldBeOk(); } [Test] - public void should_return_permissions_error_on_track_import_failed_event_if_file_exists() + public void should_return_permissions_error_on_book_import_failed_event_if_file_exists() { - var localTrack = new LocalBook + var localBook = new LocalBook { Path = Path.Combine(_downloadItemPath, "file.mp3") }; - GivenFileExists(localTrack.Path); + GivenFileExists(localBook.Path); - var importEvent = new TrackImportFailedEvent(new Exception(), localTrack, true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() }); + var importEvent = new TrackImportFailedEvent(new Exception(), localBook, true, _downloadItem); Subject.Check(importEvent).ShouldBeError(wikiFragment: "permissions-error"); } [Test] - public void should_return_permissions_error_on_track_import_failed_event_if_folder_exists() + public void should_return_permissions_error_on_book_import_failed_event_if_folder_exists() { GivenFolderExists(_downloadItemPath); @@ -211,7 +210,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_permissions_error_on_track_import_failed_event_for_local_client_if_folder_does_not_exist() + public void should_return_permissions_error_on_book_import_failed_event_for_local_client_if_folder_does_not_exist() { var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem); @@ -219,7 +218,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_mapping_error_on_track_import_failed_event_for_remote_client_if_folder_does_not_exist() + public void should_return_mapping_error_on_book_import_failed_event_for_remote_client_if_folder_does_not_exist() { _clientStatus.IsLocalhost = false; var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem); @@ -228,7 +227,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_mapping_error_on_track_import_failed_event_for_remote_client_if_path_invalid() + public void should_return_mapping_error_on_book_import_failed_event_for_remote_client_if_path_invalid() { _clientStatus.IsLocalhost = false; _downloadItem.OutputPath = new OsPath("an invalid path"); @@ -238,7 +237,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_download_client_error_on_track_import_failed_event_for_remote_client_if_path_invalid() + public void should_return_download_client_error_on_book_import_failed_event_for_remote_client_if_path_invalid() { _clientStatus.IsLocalhost = true; _downloadItem.OutputPath = new OsPath("an invalid path"); @@ -248,7 +247,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_docker_mapping_error_on_track_import_failed_event_inside_docker_if_folder_does_not_exist() + public void should_return_docker_mapping_error_on_book_import_failed_event_inside_docker_if_folder_does_not_exist() { GivenDocker(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs index e8c9d7f7c..ccc9bf5eb 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs @@ -7,6 +7,7 @@ using NzbDrone.Common.Disk; using NzbDrone.Core.Books; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.ImportLists; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -14,6 +15,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class RootFolderCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenMissingRootFolder() { var author = Builder.CreateListOfSize(1) @@ -34,7 +43,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks Mocker.GetMock() .Setup(s => s.GetParentFolder(author.First().Path)) - .Returns(@"C:\Music"); + .Returns(@"C:\Books"); Mocker.GetMock() .Setup(s => s.FolderExists(It.IsAny())) @@ -42,7 +51,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_not_return_error_when_no_author() + public void should_not_return_error_when_no_book() { Mocker.GetMock() .Setup(s => s.AllAuthorPaths()) @@ -56,7 +65,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_error_if_author_parent_is_missing() + public void should_return_error_if_book_parent_is_missing() { GivenMissingRootFolder(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/SystemTimeCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/SystemTimeCheckFixture.cs index dd1bfae2b..e31ed0a06 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/SystemTimeCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/SystemTimeCheckFixture.cs @@ -6,6 +6,7 @@ using NzbDrone.Common.Cloud; using NzbDrone.Common.Http; using NzbDrone.Common.Serializer; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks { var json = new ServiceTimeResponse { DateTimeUtc = dateTime }.ToJson(); + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected"); + Mocker.GetMock() .Setup(s => s.Execute(It.IsAny())) .Returns(r => new HttpResponse(r, new HttpHeader(), Encoding.ASCII.GetBytes(json))); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs index 751ba2e7f..64eeb9169 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs @@ -1,9 +1,10 @@ -using Moq; +using Moq; using NUnit.Framework; using NzbDrone.Common.Disk; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Update; @@ -12,6 +13,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class UpdateCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_error_when_app_folder_is_write_protected() { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs index 705ca4e82..bfddc3896 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) || _appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder)) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"), "#updating-will-not-be-possible-to-prevent-deleting-appdata-on-update"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs index 630058bd1..5385ae55f 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.HealthCheck.Checks private readonly IProvideDownloadClient _downloadClientProvider; private readonly Logger _logger; - public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, Logger logger, ILocalizationService localizationService) + public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, ILocalizationService localizationService, Logger logger) : base(localizationService) { _downloadClientProvider = downloadClientProvider; @@ -29,7 +29,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (!downloadClients.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableMessage"), "#no-download-client-is-available"); } foreach (var downloadClient in downloadClients) @@ -42,7 +42,7 @@ namespace NzbDrone.Core.HealthCheck.Checks { _logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name); - var message = $"Unable to communicate with {downloadClient.Definition.Name}."; + var message = string.Format(_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateMessage"), downloadClient.Definition.Name); return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client"); } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs index 2cbe51001..9582ddcab 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs @@ -37,10 +37,10 @@ namespace NzbDrone.Core.HealthCheck.Checks if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All download clients are unavailable due to failures", "#download-clients-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("DownloadClientStatusCheckAllClientMessage"), "#download-clients-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Download clients unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("DownloadClientStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportListStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportListStatusCheck.cs index f444f76d0..dcd0d1a66 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportListStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportListStatusCheck.cs @@ -37,10 +37,10 @@ namespace NzbDrone.Core.HealthCheck.Checks if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All import lists are unavailable due to failures", "#import-lists-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("ImportListStatusCheckAllClientMessage"), "#import-lists-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Import lists unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.ImportList.Definition.Name))), "#import-lists-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("ImportListStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.ImportList.Definition.Name))), "#import-lists-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs index 2ce2ebb9d..28ea615b1 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.HealthCheck.Checks { if (!_configService.EnableCompletedDownloadHandling) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ImportMechanismHealthCheckMessage"), "#completed-download-handling-is-disabled"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerLongTermStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerLongTermStatusCheck.cs index 3f5d44419..9ba7ffd1c 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerLongTermStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerLongTermStatusCheck.cs @@ -15,7 +15,9 @@ namespace NzbDrone.Core.HealthCheck.Checks private readonly IIndexerFactory _providerFactory; private readonly IIndexerStatusService _providerStatusService; - public IndexerLongTermStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService, ILocalizationService localizationService) + public IndexerLongTermStatusCheck(IIndexerFactory providerFactory, + IIndexerStatusService providerStatusService, + ILocalizationService localizationService) : base(localizationService) { _providerFactory = providerFactory; @@ -43,13 +45,13 @@ namespace NzbDrone.Core.HealthCheck.Checks { return new HealthCheck(GetType(), HealthCheckResult.Error, - "All indexers are unavailable due to failures for more than 6 hours", + _localizationService.GetLocalizedString("IndexerLongTermStatusCheckAllClientMessage"), "#indexers-are-unavailable-due-to-failures"); } return new HealthCheck(GetType(), HealthCheckResult.Warning, - string.Format("Indexers unavailable due to failures for more than 6 hours: {0}", + string.Format(_localizationService.GetLocalizedString("IndexerLongTermStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs index 60fca9798..1864840b2 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs @@ -25,14 +25,14 @@ namespace NzbDrone.Core.HealthCheck.Checks if (enabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "No indexers available with RSS sync enabled, Readarr will not grab new releases automatically"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"), "#no-indexers-available-with-rss-sync-enabled-readarr-will-not-grab-new-releases-automatically"); } var active = _indexerFactory.RssEnabled(true); if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"), "#indexers-are-unavailable-due-to-failures"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs index 466e8bf59..1272b5cf8 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs @@ -25,21 +25,21 @@ namespace NzbDrone.Core.HealthCheck.Checks if (automaticSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Readarr will not provide any automatic search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"), "#no-indexers-available-with-automatic-search-enabled-readarr-will-not-provide-any-automatic-search-results"); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Readarr will not provide any interactive search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"), "#no-indexers-available-with-interactive-search-enabled"); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"), "#indexers-are-unavailable-due-to-failures"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs index 215d71736..f7d6ee541 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs @@ -41,10 +41,17 @@ namespace NzbDrone.Core.HealthCheck.Checks if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All indexers are unavailable due to failures", "#indexers-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), + HealthCheckResult.Error, + _localizationService.GetLocalizedString("IndexerStatusCheckAllClientMessage"), + "#indexers-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Indexers unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), + HealthCheckResult.Warning, + string.Format(_localizationService.GetLocalizedString("IndexerStatusCheckSingleClientMessage"), + string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), + "#indexers-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs index 0fdf9a17c..6d65d7640 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs @@ -1,6 +1,5 @@ using System.Linq; using NzbDrone.Common.Disk; -using NzbDrone.Common.Extensions; using NzbDrone.Core.Books; using NzbDrone.Core.Localization; @@ -22,14 +21,14 @@ namespace NzbDrone.Core.HealthCheck.Checks { // Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution. var mounts = _authorService.AllAuthorPaths() - .Select(path => _diskProvider.GetMount(path.Value)) - .Where(m => m != null && m.MountOptions != null && m.MountOptions.IsReadOnly) - .DistinctBy(m => m.RootDirectory) - .ToList(); + .Select(p => _diskProvider.GetMount(p.Value)) + .Where(m => m != null && m.MountOptions != null && m.MountOptions.IsReadOnly) + .DistinctBy(m => m.RootDirectory) + .ToList(); if (mounts.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a author path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#author-mount-ro"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("MountCheckMessage") + string.Join(", ", mounts.Select(m => m.Name)), "#author-mount-ro"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs index 9299088aa..18e1a9d0d 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks } var message = _deploymentInfoProvider.PackageGlobalMessage; - HealthCheckResult result = HealthCheckResult.Notice; + var result = HealthCheckResult.Notice; if (message.StartsWith("Error:")) { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs index 0a0d98b7e..48ce84d92 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.HealthCheck.Checks private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; - public ProxyCheck(IReadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger, ILocalizationService localizationService) + public ProxyCheck(IReadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, ILocalizationService localizationService, Logger logger) : base(localizationService) { _configService = configService; @@ -36,7 +36,7 @@ namespace NzbDrone.Core.HealthCheck.Checks var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); if (!addresses.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckResolveIpMessage"), _configService.ProxyHostname), "#proxy-failed-resolve-ip"); } var request = _cloudRequestBuilder.Create() @@ -51,13 +51,13 @@ namespace NzbDrone.Core.HealthCheck.Checks if (response.StatusCode == HttpStatusCode.BadRequest) { _logger.Error("Proxy Health Check failed: {0}", response.StatusCode); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckBadRequestMessage"), response.StatusCode), "#proxy-failed-test"); } } catch (Exception ex) { _logger.Error(ex, "Proxy Health Check failed"); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckFailedToTestMessage"), request.Url), "#proxy-failed-test"); } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs index 34a6903c9..24b493220 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks [CheckOn(typeof(ModelEvent))] [CheckOn(typeof(TrackImportedEvent), CheckOnCondition.FailedOnly)] [CheckOn(typeof(TrackImportFailedEvent), CheckOnCondition.SuccessfulOnly)] - public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheckWithMessage + public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck { private readonly IDiskProvider _diskProvider; private readonly IProvideDownloadClient _downloadClientProvider; @@ -67,15 +67,15 @@ namespace NzbDrone.Core.HealthCheck.Checks { if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad-remote-path-mapping"); } else if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker-bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckBadDockerPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#docker-bad-remote-path-mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad-download-client-settings"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad-download-client-settings"); } } @@ -83,15 +83,15 @@ namespace NzbDrone.Core.HealthCheck.Checks { if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker-bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDockerFolderMissing"), client.Definition.Name, folder.FullPath), "#docker-bad-remote-path-mapping"); } else if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist. Likely missing or incorrect remote path mapping.", "#bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalFolderMissing"), client.Definition.Name, folder.FullPath), "#bad-remote-path-mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} places downloads in {folder.FullPath} but Readarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckGenericPermissions"), client.Definition.Name, folder.FullPath), "#permissions-error"); } } } @@ -127,13 +127,13 @@ namespace NzbDrone.Core.HealthCheck.Checks var trackPath = failureMessage.BookInfo.Path; if (_diskProvider.FileExists(trackPath)) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr can see but not access downloaded track {trackPath}. Likely permissions error.", "#permissions-error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDownloadPermissions"), trackPath), "#permissions-error"); } else { // If the file doesn't exist but TrackInfo is not null then the message is coming from // ImportApprovedTracks and the file must have been removed part way through processing - return new HealthCheck(GetType(), HealthCheckResult.Error, $"File {trackPath} was removed part way though procesing."); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFileRemoved"), trackPath), "#remote-path-file-removed"); } } @@ -149,43 +149,43 @@ namespace NzbDrone.Core.HealthCheck.Checks // that the user realises something is wrong. if (dlpath.IsNullOrWhiteSpace()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr failed to import a track. Check your logs for details."); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("RemotePathMappingCheckImportFailed"), "#remote-path-import-failed"); } if (!dlpath.IsPathValid()) { if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad-remote-path-mapping"); } else if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker-bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesBadDockerPath"), client.Definition.Name, dlpath, _osInfo.Name), "#docker-bad-remote-path-mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad-download-client-settings"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesLocalWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad-download-client-settings"); } } if (_diskProvider.FolderExists(dlpath)) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr can see but not access download directory {dlpath}. Likely permissions error.", "#permissions-error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), dlpath), "#permissions-error"); } // if it's a remote client/docker, likely missing path mappings if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker-bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), client.Definition.Name, dlpath), "#docker-bad-remote-path-mapping"); } else if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist. Likely missing remote path mapping.", "#bad-remote-path-mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckRemoteDownloadClient"), client.Definition.Name, dlpath), "#bad-remote-path-mapping"); } else { // path mappings shouldn't be needed locally so probably a permissions issue - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} reported files in {dlpath} but Readarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesGenericPermissions"), client.Definition.Name, dlpath), "#permissions-error"); } } catch (DownloadClientException ex) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs index aad3a6708..373658235 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs @@ -50,10 +50,10 @@ namespace NzbDrone.Core.HealthCheck.Checks { if (missingRootFolders.Count == 1) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder"); } - var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders)); + var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders)); return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/SystemTimeCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/SystemTimeCheck.cs index f2021e7c2..95c8b4990 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/SystemTimeCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/SystemTimeCheck.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.HealthCheck.Checks private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; private readonly Logger _logger; - public SystemTimeCheck(IHttpClient client, IReadarrCloudRequestBuilder cloudRequestBuilder, Logger logger, ILocalizationService localizationService) + public SystemTimeCheck(IHttpClient client, IReadarrCloudRequestBuilder cloudRequestBuilder, ILocalizationService localizationService, Logger logger) : base(localizationService) { _client = client; @@ -35,7 +35,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (Math.Abs(result.DateTimeUtc.Subtract(systemTime).TotalDays) >= 1) { _logger.Error("System time mismatch. SystemTime: {0} Expected Time: {1}. Update system time", systemTime, result.DateTimeUtc); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("SystemTimeCheckMessage"), "#system-time-off"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs index 692452c59..f92e29b80 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs @@ -47,33 +47,30 @@ namespace NzbDrone.Core.HealthCheck.Checks { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because startup folder '{0}' is in an App Translocation folder.", startupFolder), - "Cannot install update because startup folder is in an App Translocation folder."); + string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupTranslocationMessage"), startupFolder), + "#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder."); } if (!_diskProvider.FolderWritable(startupFolder)) { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName), - "Cannot install update because startup folder is not writable by the user"); + string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupNotWritableMessage"), startupFolder, Environment.UserName), + "#cannot-install-update-because-startup-folder-is-not-writable-by-the-user"); } if (!_diskProvider.FolderWritable(uiFolder)) { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName), - "Cannot install update because UI folder is not writable by the user"); + string.Format(_localizationService.GetLocalizedString("UpdateCheckUINotWritableMessage"), uiFolder, Environment.UserName), + "#cannot-install-update-because-ui-folder-is-not-writable-by-the-user"); } } - if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14)) + if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14) && _checkUpdateService.AvailableUpdate() != null) { - if (_checkUpdateService.AvailableUpdate() != null) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "New update is available"); - } + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("UpdateAvailable"), "#new-update-is-available"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/EventDrivenHealthCheck.cs b/src/NzbDrone.Core/HealthCheck/EventDrivenHealthCheck.cs index 544c0d9c3..32dc48bff 100644 --- a/src/NzbDrone.Core/HealthCheck/EventDrivenHealthCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/EventDrivenHealthCheck.cs @@ -1,4 +1,3 @@ -using System; using NzbDrone.Common.Messaging; namespace NzbDrone.Core.HealthCheck diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 598d81ee8..0ee317fd6 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -32,6 +32,7 @@ "APIKey": "API Key", "ApiKeyHelpTextWarning": "Requires restart to take effect", "AppDataDirectory": "AppData directory", + "AppDataLocationHealthCheckMessage": "Updating will not be possible to prevent deleting AppData on Update", "ApplyTags": "Apply Tags", "ApplyTagsHelpTexts1": "How to apply tags to the selected author", "ApplyTagsHelpTexts2": "Add: Add the tags the existing list of tags", @@ -190,8 +191,10 @@ "Docker": "Docker", "DownloadClient": "Download Client", "DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.", + "DownloadClientCheckNoneAvailableMessage": "No download client is available", "DownloadClients": "Download Clients", "DownloadClientSettings": "Download Client Settings", + "DownloadClientStatusCheckAllClientMessage": "All download clients are unavailable due to failures", "DownloadFailedCheckDownloadClientForMoreDetails": "Download failed: check download client for more details", "DownloadFailedInterp": "Download failed: {0}", "DownloadPropersAndRepacksHelpTexts1": "Whether or not to automatically upgrade to Propers/Repacks", @@ -297,6 +300,8 @@ "ImportLists": "Import Lists", "ImportListSettings": "General Import List Settings", "ImportListSpecificSettings": "Import List Specific Settings", + "ImportListStatusCheckAllClientMessage": "All lists are unavailable due to failures", + "ImportMechanismHealthCheckMessage": "Enable Completed Download Handling", "IncludeHealthWarningsHelpText": "Include Health Warnings", "IncludePreferredWhenRenaming": "Include Preferred when Renaming", "IncludeUnknownAuthorItemsHelpText": "Show items without a author in the queue, this could include removed authors, movies or anything else in Readarr's category", @@ -306,10 +311,14 @@ "IndexerIdHelpTextWarning": "Using a specific indexer with preferred words can lead to duplicate releases being grabbed", "IndexerIdvalue0IncludeInPreferredWordsRenamingFormat": "Include in {Preferred Words} renaming format", "IndexerIdvalue0OnlySupportedWhenIndexerIsSetToAll": "Only supported when Indexer is set to (All)", + "IndexerLongTermStatusCheckAllClientMessage": "All indexers are unavailable due to failures for more than 6 hours", "IndexerPriority": "Indexer Priority", + "IndexerRssHealthCheckNoIndexers": "No indexers available with RSS sync enabled, Readarr will not grab new releases automatically", "Indexers": "Indexers", + "IndexerSearchCheckNoAutomaticMessage": "No indexers available with Automatic Search enabled, Readarr will not provide any automatic search results", "IndexerSettings": "Indexer Settings", "IndexersSettingsSummary": "Download clients, download handling and remote path mappings", + "IndexerStatusCheckAllClientMessage": "All indexers are unavailable due to failures", "Interval": "Interval", "ISBN": "ISBN", "IsCalibreLibraryHelpText": "Use Calibre Content Server to manipulate library", @@ -402,6 +411,7 @@ "MonitorNewItemsHelpText": "Which new books should be monitored", "MonoVersion": "Mono Version", "MoreInfo": "More Info", + "MountCheckMessage": "Mount containing an author path is mounted read-only: ", "MusicBrainzAuthorID": "MusicBrainz Author ID", "MusicBrainzBookID": "MusicBrainz Book ID", "MusicbrainzId": "Musicbrainz Id", @@ -495,6 +505,7 @@ "ProtocolHelpText": "Choose which protocol(s) to use and which one is preferred when choosing between otherwise equal releases", "Proxy": "Proxy", "ProxyBypassFilterHelpText": "Use ',' as a separator, and '*.' as a wildcard for subdomains", + "ProxyCheckResolveIpMessage": "Failed to resolve the IP Address for the Configured Proxy Host {0}", "ProxyPasswordHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.", "ProxyType": "Proxy Type", "ProxyUsernameHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.", @@ -538,6 +549,7 @@ "Reload": "Reload", "RemotePath": "Remote Path", "RemotePathHelpText": "Root path to the directory that the Download Client accesses", + "RemotePathMappingCheckWrongOSPath": "Remote download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", "RemotePathMappings": "Remote Path Mappings", "Remove": "Remove", "RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history", @@ -575,6 +587,7 @@ "RetentionHelpText": "Usenet only: Set to zero to set for unlimited retention", "RetryingDownloadInterp": "Retrying download {0} at {1}", "RootFolder": "Root Folder", + "RootFolderCheckSingleMessage": "Missing root folder: {0}", "RootFolderPathHelpText": "Root Folder list items will be added to", "RootFolders": "Root Folders", "RSSSync": "RSS Sync", @@ -672,6 +685,7 @@ "SupportsSearchvalueSearchIsNotSupportedWithThisIndexer": "Search is not supported with this indexer", "SupportsSearchvalueWillBeUsedWhenAutomaticSearchesArePerformedViaTheUIOrByReadarr": "Will be used when automatic searches are performed via the UI or by Readarr", "SupportsSearchvalueWillBeUsedWhenInteractiveSearchIsUsed": "Will be used when interactive search is used", + "SystemTimeCheckMessage": "System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected", "TagIsNotUsedAndCanBeDeleted": "Tag is not used and can be deleted", "Tags": "Tags", "TagsHelpText": "Applies to authors with at least one matching tag. Leave blank to apply to all authors", @@ -749,6 +763,7 @@ "UnselectAll": "Unselect All", "UpdateAll": "Update all", "UpdateAutomaticallyHelpText": "Automatically download and install updates. You will still be able to install from System: Updates", + "UpdateCheckStartupTranslocationMessage": "Cannot install update because startup folder '{0}' is in an App Translocation folder.", "UpdateCovers": "Update Covers", "UpdateCoversHelpText": "Set book covers in Calibre to match those in Readarr", "UpdateMechanismHelpText": "Use Readarr's built-in updater or a script",