Removed deprecated code.
This commit is contained in:
parent
dcc988da06
commit
ebbaa403f6
|
@ -180,8 +180,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
|||
|
||||
public override IEnumerable<DownloadClientItem> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -177,8 +177,6 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
|||
|
||||
public override IEnumerable<DownloadClientItem> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue