diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index fae79fb13..81429c5b0 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -180,8 +180,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget public override IEnumerable GetItems() { - MigrateLocalCategoryPath(); - return GetQueue().Concat(GetHistory()).Where(downloadClientItem => downloadClientItem.Category == Settings.TvCategory); } @@ -294,35 +292,5 @@ namespace NzbDrone.Core.Download.Clients.Nzbget return result; } - - // TODO: Remove around January 2015, this code moves the settings to the RemotePathMappingService. - private void MigrateLocalCategoryPath() - { - if (!Settings.TvCategoryLocalPath.IsNullOrWhiteSpace()) - { - try - { - _logger.Debug("Has legacy TvCategoryLocalPath, trying to migrate to RemotePathMapping list."); - - var config = _proxy.GetConfig(Settings); - var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.TvCategory); - - if (category != null) - { - var localPath = new OsPath(Settings.TvCategoryLocalPath); - Settings.TvCategoryLocalPath = null; - - _remotePathMappingService.MigrateLocalCategoryPath(Definition.Id, Settings, Settings.Host, new OsPath(category.DestDir), localPath); - - _logger.Info("Discovered Local Category Path for {0}, the setting was automatically moved to the Remote Path Mapping table.", Definition.Name); - } - } - catch (DownloadClientException ex) - { - _logger.ErrorException("Unable to migrate local category path", ex); - throw; - } - } - } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs index 300dcbac5..00ce58d44 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs @@ -17,9 +17,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget RuleFor(c => c.Username).NotEmpty().When(c => !String.IsNullOrWhiteSpace(c.Password)); RuleFor(c => c.Password).NotEmpty().When(c => !String.IsNullOrWhiteSpace(c.Username)); - RuleFor(c => c.TvCategory).NotEmpty().When(c => !String.IsNullOrWhiteSpace(c.TvCategoryLocalPath)); - RuleFor(c => c.TvCategoryLocalPath).IsValidPath().When(c => !String.IsNullOrWhiteSpace(c.TvCategoryLocalPath)); - RuleFor(c => c.TvCategory).NotEmpty().WithMessage("A category is recommended").AsWarning(); } } @@ -52,9 +49,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget [FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional")] public String TvCategory { get; set; } - // TODO: Remove around January 2015, this setting was superceded by the RemotePathMappingService, but has to remain for a while to properly migrate. - public String TvCategoryLocalPath { get; set; } - [FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(NzbgetPriority), HelpText = "Priority to use when grabbing episodes that aired within the last 14 days")] public Int32 RecentTvPriority { get; set; } diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index e90fdbaa0..df56cd7e7 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -177,8 +177,6 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd public override IEnumerable GetItems() { - MigrateLocalCategoryPath(); - foreach (var downloadClientItem in GetQueue().Concat(GetHistory())) { if (downloadClientItem.Category == Settings.TvCategory || downloadClientItem.Category == "*" && Settings.TvCategory.IsNullOrWhiteSpace()) @@ -351,35 +349,5 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd return null; } - - private void MigrateLocalCategoryPath() - { - // TODO: Remove around January 2015, this code moves the settings to the RemotePathMappingService. - if (!Settings.TvCategoryLocalPath.IsNullOrWhiteSpace()) - { - try - { - _logger.Debug("Has legacy TvCategoryLocalPath, trying to migrate to RemotePathMapping list."); - - var config = _proxy.GetConfig(Settings); - var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.TvCategory); - - if (category != null) - { - var localPath = new OsPath(Settings.TvCategoryLocalPath); - Settings.TvCategoryLocalPath = null; - - _remotePathMappingService.MigrateLocalCategoryPath(Definition.Id, Settings, Settings.Host, category.FullPath, localPath); - - _logger.Info("Discovered Local Category Path for {0}, the setting was automatically moved to the Remote Path Mapping table.", Definition.Name); - } - } - catch (DownloadClientException ex) - { - _logger.ErrorException("Unable to migrate local category path", ex); - throw; - } - } - } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs index b360be487..c5d8e1e84 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs @@ -63,9 +63,6 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd [FieldDefinition(5, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional")] public String TvCategory { get; set; } - // TODO: Remove around January 2015, this setting was superceded by the RemotePathMappingService, but has to remain for a while to properly migrate. - public String TvCategoryLocalPath { get; set; } - [FieldDefinition(6, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(SabnzbdPriority), HelpText = "Priority to use when grabbing episodes that aired within the last 14 days")] public Int32 RecentTvPriority { get; set; } diff --git a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs index 93c6dd424..3a45fe29d 100644 --- a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs +++ b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs @@ -21,15 +21,10 @@ namespace NzbDrone.Core.RemotePathMappings OsPath RemapRemoteToLocal(String host, OsPath remotePath); OsPath RemapLocalToRemote(String host, OsPath localPath); - - // TODO: Remove around January 2015. Used to migrate legacy Local Category Path settings. - void MigrateLocalCategoryPath(Int32 downloadClientId, IProviderConfig newSettings, String host, OsPath remotePath, OsPath localPath); } public class RemotePathMappingService : IRemotePathMappingService { - // TODO: Remove DownloadClientRepository reference around January 2015. Used to migrate legacy Local Category Path settings. - private readonly IDownloadClientRepository _downloadClientRepository; private readonly IRemotePathMappingRepository _remotePathMappingRepository; private readonly IDiskProvider _diskProvider; private readonly Logger _logger; @@ -42,7 +37,6 @@ namespace NzbDrone.Core.RemotePathMappings ICacheManager cacheManager, Logger logger) { - _downloadClientRepository = downloadClientRepository; _remotePathMappingRepository = remotePathMappingRepository; _diskProvider = diskProvider; _logger = logger; @@ -166,22 +160,5 @@ namespace NzbDrone.Core.RemotePathMappings return localPath; } - - // TODO: Remove around January 2015. Used to migrate legacy Local Category Path settings. - public void MigrateLocalCategoryPath(Int32 downloadClientId, IProviderConfig newSettings, String host, OsPath remotePath, OsPath localPath) - { - _logger.Debug("Migrating local category path for Host {0}/{1} to {2}", host, remotePath, localPath); - - var existingMappings = All().Where(v => v.Host == host).ToList(); - - if (!existingMappings.Any(v => new OsPath(v.LocalPath) == localPath && new OsPath(v.RemotePath) == remotePath)) - { - Add(new RemotePathMapping { Host = host, RemotePath = remotePath.FullPath, LocalPath = localPath.FullPath }); - } - - var downloadClient = _downloadClientRepository.Get(downloadClientId); - downloadClient.Settings = newSettings; - _downloadClientRepository.Update(downloadClient); - } } } \ No newline at end of file