Rename TvCategory to MusicCategory for Clients

pull/221/head
Qstick 6 years ago
parent 8ef80ba135
commit e8771c9c78

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
Subject.Definition = new DownloadClientDefinition();
Subject.Definition.Settings = new DelugeSettings()
{
TvCategory = null
MusicCategory = null
};
_queued = new DelugeTorrent

@ -296,7 +296,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
protected void GivenTvCategory()
{
_settings.TvCategory = _category;
_settings.MusicCategory = _category;
}
protected void GivenTvDirectory()

@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
protected void GivenTvCategory()
{
_settings.TvCategory = _category;
_settings.MusicCategory = _category;
}
protected void GivenTvDirectory()

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests
Host = "127.0.0.1",
Port = 2222,
ApiKey = "1234-ABCD",
TvCategory = "Music",
MusicCategory = "Music",
RecentTvPriority = (int)NzbgetPriority.High
};
@ -298,7 +298,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests
{
Mocker.GetMock<INzbVortexProxy>()
.Setup(v => v.GetGroups(It.IsAny<NzbVortexSettings>()))
.Returns(new List<NzbVortexGroup> { new NzbVortexGroup { GroupName = ((NzbVortexSettings)Subject.Definition.Settings).TvCategory } });
.Returns(new List<NzbVortexGroup> { new NzbVortexGroup { GroupName = ((NzbVortexSettings)Subject.Definition.Settings).MusicCategory } });
Mocker.GetMock<INzbVortexProxy>()
.Setup(v => v.GetApiVersion(It.IsAny<NzbVortexSettings>()))

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
Port = 2222,
Username = "admin",
Password = "pass",
TvCategory = "music",
MusicCategory = "music",
RecentTvPriority = (int)NzbgetPriority.High
};

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Port = 2222,
Username = "admin",
Password = "pass",
TvCategory = "tv"
MusicCategory = "tv"
};
Mocker.GetMock<ITorrentFileInfoReader>()

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.RTorrentTests
Subject.Definition = new DownloadClientDefinition();
Subject.Definition.Settings = new RTorrentSettings()
{
TvCategory = null
MusicCategory = null
};
_downloading = new RTorrentTorrent

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
ApiKey = "5c770e3197e4fe763423ee7c392c25d1",
Username = "admin",
Password = "pass",
TvCategory = "tv",
MusicCategory = "tv",
RecentTvPriority = (int)SabnzbdPriority.High
};
_queued = new SabnzbdQueue
@ -568,7 +568,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
[Test]
public void should_test_failed_if_tv_sorting_default_category()
{
Subject.Definition.Settings.As<SabnzbdSettings>().TvCategory = null;
Subject.Definition.Settings.As<SabnzbdSettings>().MusicCategory = null;
_config.Misc.enable_tv_sorting = true;
_config.Misc.tv_categories = new[] { "Default" };

@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
protected void GivenTvCategory()
{
_settings.TvCategory = "Lidarr";
_settings.MusicCategory = "Lidarr";
}
protected void GivenTvDirectory()

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Port = 2222,
Username = "admin",
Password = "pass",
TvCategory = "lidarr"
MusicCategory = "lidarr"
};
_queued = new UTorrentTorrent

@ -35,9 +35,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
{
var actualHash = _proxy.AddTorrentFromMagnet(magnetLink, Settings);
if (!Settings.TvCategory.IsNullOrWhiteSpace())
if (!Settings.MusicCategory.IsNullOrWhiteSpace())
{
_proxy.SetLabel(actualHash, Settings.TvCategory, Settings);
_proxy.SetLabel(actualHash, Settings.MusicCategory, Settings);
}
var isRecentAlbum = remoteAlbum.IsRecentAlbum();
@ -60,9 +60,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
throw new DownloadClientException("Deluge failed to add torrent " + filename);
}
if (!Settings.TvCategory.IsNullOrWhiteSpace())
if (!Settings.MusicCategory.IsNullOrWhiteSpace())
{
_proxy.SetLabel(actualHash, Settings.TvCategory, Settings);
_proxy.SetLabel(actualHash, Settings.MusicCategory, Settings);
}
var isRecentAlbum = remoteAlbum.IsRecentAlbum();
@ -82,9 +82,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
{
IEnumerable<DelugeTorrent> torrents;
if (!Settings.TvCategory.IsNullOrWhiteSpace())
if (!Settings.MusicCategory.IsNullOrWhiteSpace())
{
torrents = _proxy.GetTorrentsByLabel(Settings.TvCategory, Settings);
torrents = _proxy.GetTorrentsByLabel(Settings.MusicCategory, Settings);
}
else
{
@ -98,7 +98,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
var item = new DownloadClientItem();
item.DownloadId = torrent.Hash.ToUpper();
item.Title = torrent.Name;
item.Category = Settings.TvCategory;
item.Category = Settings.MusicCategory;
item.DownloadClient = Definition.Name;
@ -231,7 +231,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
private ValidationFailure TestCategory()
{
if (Settings.TvCategory.IsNullOrWhiteSpace())
if (Settings.MusicCategory.IsNullOrWhiteSpace())
{
return null;
}
@ -248,12 +248,12 @@ namespace NzbDrone.Core.Download.Clients.Deluge
var labels = _proxy.GetAvailableLabels(Settings);
if (!labels.Contains(Settings.TvCategory))
if (!labels.Contains(Settings.MusicCategory))
{
_proxy.AddLabel(Settings.TvCategory, Settings);
_proxy.AddLabel(Settings.MusicCategory, Settings);
labels = _proxy.GetAvailableLabels(Settings);
if (!labels.Contains(Settings.TvCategory))
if (!labels.Contains(Settings.MusicCategory))
{
return new NzbDroneValidationFailure("TvCategory", "Configuration of label failed")
{

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
RuleFor(c => c.Host).ValidHost();
RuleFor(c => c.Port).InclusiveBetween(1, 65535);
RuleFor(c => c.TvCategory).Matches("^[-a-z]*$").WithMessage("Allowed characters a-z and -");
RuleFor(c => c.MusicCategory).Matches("^[-a-z]*$").WithMessage("Allowed characters a-z and -");
}
}
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
Host = "localhost";
Port = 8112;
Password = "deluge";
TvCategory = "lidarr";
MusicCategory = "lidarr";
}
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using FluentValidation;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Annotations;
@ -18,9 +18,9 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
.When(c => c.TvDirectory.IsNotNullOrWhiteSpace())
.WithMessage("Cannot start with /");
RuleFor(c => c.TvCategory).Matches(@"^\.?[-a-z]*$", RegexOptions.IgnoreCase).WithMessage("Allowed characters a-z and -");
RuleFor(c => c.MusicCategory).Matches(@"^\.?[-a-z]*$", RegexOptions.IgnoreCase).WithMessage("Allowed characters a-z and -");
RuleFor(c => c.TvCategory).Empty()
RuleFor(c => c.MusicCategory).Empty()
.When(c => c.TvDirectory.IsNotNullOrWhiteSpace())
.WithMessage("Cannot use Category and Directory");
}
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional. Creates a [category] subdirectory in the output directory.")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(5, Label = "Directory", Type = FieldType.Textbox, HelpText = "Optional shared folder to put downloads into, leave blank to use the default Download Station location")]
public string TvDirectory { get; set; }

@ -70,10 +70,10 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
continue;
}
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var directories = outputPath.FullPath.Split('\\', '/');
if (!directories.Contains(Settings.TvCategory))
if (!directories.Contains(Settings.MusicCategory))
{
continue;
}
@ -81,7 +81,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
var item = new DownloadClientItem()
{
Category = Settings.TvCategory,
Category = Settings.MusicCategory,
DownloadClient = Definition.Name,
DownloadId = CreateDownloadId(torrent.Id, serialNumber),
Title = torrent.Title,
@ -297,7 +297,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
if (downloadDir != null)
{
var sharedFolder = downloadDir.Split('\\', '/')[0];
var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.TvCategory);
var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.MusicCategory);
var folderInfo = _fileStationProxy.GetInfoFileOrDirectory($"/{downloadDir}", Settings);
@ -418,11 +418,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
{
return Settings.TvDirectory.TrimStart('/');
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var destDir = GetDefaultDir();
return $"{destDir.TrimEnd('/')}/{Settings.TvCategory}";
return $"{destDir.TrimEnd('/')}/{Settings.MusicCategory}";
}
return null;

@ -81,10 +81,10 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
continue;
}
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var directories = outputPath.FullPath.Split('\\', '/');
if (!directories.Contains(Settings.TvCategory))
if (!directories.Contains(Settings.MusicCategory))
{
continue;
}
@ -92,7 +92,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
var item = new DownloadClientItem()
{
Category = Settings.TvCategory,
Category = Settings.MusicCategory,
DownloadClient = Definition.Name,
DownloadId = CreateDownloadId(nzb.Id, serialNumber),
Title = nzb.Title,
@ -210,7 +210,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
if (downloadDir != null)
{
var sharedFolder = downloadDir.Split('\\', '/')[0];
var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.TvCategory);
var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.MusicCategory);
var folderInfo = _fileStationProxy.GetInfoFileOrDirectory($"/{downloadDir}", Settings);
@ -409,11 +409,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
{
return Settings.TvDirectory.TrimStart('/');
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var destDir = GetDefaultDir();
return $"{destDir.TrimEnd('/')}/{Settings.TvCategory}";
return $"{destDir.TrimEnd('/')}/{Settings.MusicCategory}";
}
return null;

@ -204,11 +204,11 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
private ValidationFailure TestCategory()
{
var group = GetGroups().FirstOrDefault(c => c.GroupName == Settings.TvCategory);
var group = GetGroups().FirstOrDefault(c => c.GroupName == Settings.MusicCategory);
if (group == null)
{
if (Settings.TvCategory.IsNotNullOrWhiteSpace())
if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
return new NzbDroneValidationFailure("TvCategory", "Group does not exist")
{

@ -43,9 +43,9 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
.Post()
.AddQueryParam("priority", priority.ToString());
if (settings.TvCategory.IsNotNullOrWhiteSpace())
if (settings.MusicCategory.IsNotNullOrWhiteSpace())
{
requestBuilder.AddQueryParam("groupname", settings.TvCategory);
requestBuilder.AddQueryParam("groupname", settings.MusicCategory);
}
requestBuilder.AddFormUpload("name", filename, nzbData, "application/x-nzb");
@ -93,9 +93,9 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
var requestBuilder = BuildRequest(settings).Resource("nzb");
if (settings.TvCategory.IsNotNullOrWhiteSpace())
if (settings.MusicCategory.IsNotNullOrWhiteSpace())
{
requestBuilder.AddQueryParam("groupName", settings.TvCategory);
requestBuilder.AddQueryParam("groupName", settings.MusicCategory);
}
requestBuilder.AddQueryParam("limitDone", doneLimit.ToString());

@ -1,4 +1,4 @@
using FluentValidation;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
@ -15,7 +15,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
RuleFor(c => c.ApiKey).NotEmpty()
.WithMessage("API Key is required");
RuleFor(c => c.TvCategory).NotEmpty()
RuleFor(c => c.MusicCategory).NotEmpty()
.WithMessage("A category is recommended")
.AsWarning();
}
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
{
Host = "localhost";
Port = 4321;
TvCategory = "Music";
MusicCategory = "Music";
RecentTvPriority = (int)NzbVortexPriority.Normal;
OlderTvPriority = (int)NzbVortexPriority.Normal;
}
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
public string ApiKey { get; set; }
[FieldDefinition(3, Label = "Group", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(4, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(NzbVortexPriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
protected override string AddFromNzbFile(RemoteAlbum remoteAlbum, string filename, byte[] fileContent)
{
var category = Settings.TvCategory;
var category = Settings.MusicCategory;
var priority = remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority;
@ -182,7 +182,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public override IEnumerable<DownloadClientItem> GetItems()
{
return GetQueue().Concat(GetHistory()).Where(downloadClientItem => downloadClientItem.Category == Settings.TvCategory);
return GetQueue().Concat(GetHistory()).Where(downloadClientItem => downloadClientItem.Category == Settings.MusicCategory);
}
public override void RemoveItem(string downloadId, bool deleteData)
@ -199,7 +199,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
{
var config = _proxy.GetConfig(Settings);
var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.TvCategory);
var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.MusicCategory);
var status = new DownloadClientInfo
{
@ -282,7 +282,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
var config = _proxy.GetConfig(Settings);
var categories = GetCategories(config);
if (!Settings.TvCategory.IsNullOrWhiteSpace() && !categories.Any(v => v.Name == Settings.TvCategory))
if (!Settings.MusicCategory.IsNullOrWhiteSpace() && !categories.Any(v => v.Name == Settings.MusicCategory))
{
return new NzbDroneValidationFailure("TvCategory", "Category does not exist")
{

@ -14,7 +14,7 @@ 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().WithMessage("A category is recommended").AsWarning();
RuleFor(c => c.MusicCategory).NotEmpty().WithMessage("A category is recommended").AsWarning();
}
}
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
{
Host = "localhost";
Port = 6789;
TvCategory = "Music";
MusicCategory = "Music";
Username = "nzbget";
Password = "tegbzn6789";
RecentTvPriority = (int)NzbgetPriority.Normal;
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(NzbgetPriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

@ -35,9 +35,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
{
_proxy.AddTorrentFromUrl(magnetLink, Settings);
if (Settings.TvCategory.IsNotNullOrWhiteSpace())
if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
_proxy.SetTorrentLabel(hash.ToLower(), Settings.TvCategory, Settings);
_proxy.SetTorrentLabel(hash.ToLower(), Settings.MusicCategory, Settings);
}
var isRecentEpisode = remoteAlbum.IsRecentAlbum();
@ -59,9 +59,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
try
{
if (Settings.TvCategory.IsNotNullOrWhiteSpace())
if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
_proxy.SetTorrentLabel(hash.ToLower(), Settings.TvCategory, Settings);
_proxy.SetTorrentLabel(hash.ToLower(), Settings.MusicCategory, Settings);
}
}
catch (Exception ex)
@ -204,7 +204,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
else if (version < 6)
{
// API version 6 introduced support for labels
if (Settings.TvCategory.IsNotNullOrWhiteSpace())
if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
return new NzbDroneValidationFailure("Category", "Category is not supported")
{
@ -212,7 +212,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
};
}
}
else if (Settings.TvCategory.IsNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNullOrWhiteSpace())
{
// warn if labels are supported, but category is not provided
return new NzbDroneValidationFailure("TvCategory", "Category is recommended")

@ -61,8 +61,8 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
public List<QBittorrentTorrent> GetTorrents(QBittorrentSettings settings)
{
var request = BuildRequest(settings).Resource("/query/torrents")
.AddQueryParam("label", settings.TvCategory)
.AddQueryParam("category", settings.TvCategory);
.AddQueryParam("label", settings.MusicCategory)
.AddQueryParam("category", settings.MusicCategory);
var response = ProcessRequest<List<QBittorrentTorrent>>(request, settings);
@ -75,9 +75,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
.Post()
.AddFormParameter("urls", torrentUrl);
if (settings.TvCategory.IsNotNullOrWhiteSpace())
if (settings.MusicCategory.IsNotNullOrWhiteSpace())
{
request.AddFormParameter("category", settings.TvCategory);
request.AddFormParameter("category", settings.MusicCategory);
}
var result = ProcessRequest(request, settings);
@ -110,9 +110,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
.Post()
.AddFormParameter("hashes", hash);
if (settings.TvCategory.IsNotNullOrWhiteSpace())
if (settings.MusicCategory.IsNotNullOrWhiteSpace())
{
request.AddFormParameter("category", settings.TvCategory);
request.AddFormParameter("category", settings.MusicCategory);
}
ProcessRequest(request, settings);

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
{
Host = "localhost";
Port = 8080;
TvCategory = "lidarr";
MusicCategory = "lidarr";
}
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
@ -38,7 +38,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(QBittorrentPriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
protected override string AddFromNzbFile(RemoteAlbum remoteAlbum, string filename, byte[] fileContent)
{
var category = Settings.TvCategory;
var category = Settings.MusicCategory;
var priority = remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority;
var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings);
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
private IEnumerable<DownloadClientItem> GetHistory()
{
var sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings.TvCategory, Settings);
var sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings.MusicCategory, Settings);
var historyItems = new List<DownloadClientItem>();
@ -192,7 +192,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
foreach (var downloadClientItem in GetQueue().Concat(GetHistory()))
{
if (downloadClientItem.Category == Settings.TvCategory || downloadClientItem.Category == "*" && Settings.TvCategory.IsNullOrWhiteSpace())
if (downloadClientItem.Category == Settings.MusicCategory || downloadClientItem.Category == "*" && Settings.MusicCategory.IsNullOrWhiteSpace())
{
yield return downloadClientItem;
}
@ -246,7 +246,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
var config = _proxy.GetConfig(Settings);
var categories = GetCategories(config).ToArray();
var category = categories.FirstOrDefault(v => v.Name == Settings.TvCategory);
var category = categories.FirstOrDefault(v => v.Name == Settings.MusicCategory);
if (category == null)
{
@ -429,7 +429,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
private ValidationFailure TestCategory()
{
var config = _proxy.GetConfig(Settings);
var category = GetCategories(config).FirstOrDefault((SabnzbdCategory v) => v.Name == Settings.TvCategory);
var category = GetCategories(config).FirstOrDefault((SabnzbdCategory v) => v.Name == Settings.MusicCategory);
if (category != null)
{
@ -444,7 +444,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
}
else
{
if (!Settings.TvCategory.IsNullOrWhiteSpace())
if (!Settings.MusicCategory.IsNullOrWhiteSpace())
{
return new NzbDroneValidationFailure("TvCategory", "Category does not exist")
{
@ -453,7 +453,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
};
}
}
if (config.Misc.enable_tv_sorting && ContainsCategory(config.Misc.tv_categories, Settings.TvCategory))
if (config.Misc.enable_tv_sorting && ContainsCategory(config.Misc.tv_categories, Settings.MusicCategory))
{
return new NzbDroneValidationFailure("TvCategory", "Disable TV Sorting")
{
@ -461,7 +461,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
DetailedDescription = "You must disable Sabnzbd TV Sorting for the category Lidarr uses to prevent import issues. Go to Sabnzbd to fix it."
};
}
if (config.Misc.enable_movie_sorting && ContainsCategory(config.Misc.movie_categories, Settings.TvCategory))
if (config.Misc.enable_movie_sorting && ContainsCategory(config.Misc.movie_categories, Settings.MusicCategory))
{
return new NzbDroneValidationFailure("TvCategory", "Disable Movie Sorting")
{
@ -469,7 +469,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
DetailedDescription = "You must disable Sabnzbd Movie Sorting for the category Lidarr uses to prevent import issues. Go to Sabnzbd to fix it."
};
}
if (config.Misc.enable_date_sorting && ContainsCategory(config.Misc.date_categories, Settings.TvCategory))
if (config.Misc.enable_date_sorting && ContainsCategory(config.Misc.date_categories, Settings.MusicCategory))
{
return new NzbDroneValidationFailure("TvCategory", "Disable Date Sorting")
{

@ -1,4 +1,4 @@
using FluentValidation;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
.WithMessage("Password is required when API key is not configured")
.When(c => string.IsNullOrWhiteSpace(c.ApiKey));
RuleFor(c => c.TvCategory).NotEmpty()
RuleFor(c => c.MusicCategory).NotEmpty()
.WithMessage("A category is recommended")
.AsWarning();
}
@ -38,7 +38,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
Host = "localhost";
Port = 8080;
TvCategory = "music";
MusicCategory = "music";
RecentTvPriority = (int)SabnzbdPriority.Default;
OlderTvPriority = (int)SabnzbdPriority.Default;
}
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
public string Password { get; set; }
[FieldDefinition(5, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(6, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(SabnzbdPriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

@ -48,17 +48,17 @@ namespace NzbDrone.Core.Download.Clients.Transmission
{
if (!new OsPath(Settings.TvDirectory).Contains(outputPath)) continue;
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var directories = outputPath.FullPath.Split('\\', '/');
if (!directories.Contains(Settings.TvCategory)) continue;
if (!directories.Contains(Settings.MusicCategory)) continue;
}
outputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, outputPath);
var item = new DownloadClientItem();
item.DownloadId = torrent.HashString.ToUpper();
item.Category = Settings.TvCategory;
item.Category = Settings.MusicCategory;
item.Title = torrent.Name;
item.DownloadClient = Definition.Name;
@ -114,9 +114,9 @@ namespace NzbDrone.Core.Download.Clients.Transmission
var config = _proxy.GetConfig(Settings);
var destDir = config.GetValueOrDefault("download-dir") as string;
if (Settings.TvCategory.IsNotNullOrWhiteSpace())
if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
destDir = string.Format("{0}/.{1}", destDir, Settings.TvCategory);
destDir = string.Format("{0}/.{1}", destDir, Settings.MusicCategory);
}
return new DownloadClientInfo
@ -174,12 +174,12 @@ namespace NzbDrone.Core.Download.Clients.Transmission
{
return Settings.TvDirectory;
}
else if (Settings.TvCategory.IsNotNullOrWhiteSpace())
else if (Settings.MusicCategory.IsNotNullOrWhiteSpace())
{
var config = _proxy.GetConfig(Settings);
var destDir = (string)config.GetValueOrDefault("download-dir");
return string.Format("{0}/{1}", destDir.TrimEnd('/'), Settings.TvCategory);
return string.Format("{0}/{1}", destDir.TrimEnd('/'), Settings.MusicCategory);
}
else
{

@ -16,9 +16,9 @@ namespace NzbDrone.Core.Download.Clients.Transmission
RuleFor(c => c.UrlBase).ValidUrlBase();
RuleFor(c => c.TvCategory).Matches(@"^\.?[-a-z]*$", RegexOptions.IgnoreCase).WithMessage("Allowed characters a-z and -");
RuleFor(c => c.MusicCategory).Matches(@"^\.?[-a-z]*$", RegexOptions.IgnoreCase).WithMessage("Allowed characters a-z and -");
RuleFor(c => c.TvCategory).Empty()
RuleFor(c => c.MusicCategory).Empty()
.When(c => c.TvDirectory.IsNotNullOrWhiteSpace())
.WithMessage("Cannot use Category and Directory");
}
@ -51,7 +51,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
public string Password { get; set; }
[FieldDefinition(5, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional. Creates a [category] subdirectory in the output directory.")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(6, Label = "Directory", Type = FieldType.Textbox, Advanced = true, HelpText = "Optional location to put downloads in, leave blank to use the default Transmission location")]
public string TvDirectory { get; set; }

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
{
var priority = (RTorrentPriority)(remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority);
_proxy.AddTorrentFromUrl(magnetLink, Settings.TvCategory, priority, Settings.TvDirectory, Settings);
_proxy.AddTorrentFromUrl(magnetLink, Settings.MusicCategory, priority, Settings.TvDirectory, Settings);
var tries = 10;
var retryDelay = 500;
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
{
var priority = (RTorrentPriority)(remoteEpisode.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority);
_proxy.AddTorrentFromFile(filename, fileContent, Settings.TvCategory, priority, Settings.TvDirectory, Settings);
_proxy.AddTorrentFromFile(filename, fileContent, Settings.MusicCategory, priority, Settings.TvDirectory, Settings);
var tries = 10;
var retryDelay = 500;
@ -89,7 +89,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
foreach (RTorrentTorrent torrent in torrents)
{
// Don't concern ourselves with categories other than specified
if (torrent.Category != Settings.TvCategory) continue;
if (torrent.Category != Settings.MusicCategory) continue;
if (torrent.Path.StartsWith("."))
{

@ -1,4 +1,4 @@
using FluentValidation;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
@ -11,7 +11,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
{
RuleFor(c => c.Host).ValidHost();
RuleFor(c => c.Port).InclusiveBetween(1, 65535);
RuleFor(c => c.TvCategory).NotEmpty()
RuleFor(c => c.MusicCategory).NotEmpty()
.WithMessage("A category is recommended")
.AsWarning();
}
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
Host = "localhost";
Port = 8080;
UrlBase = "RPC2";
TvCategory = "lidarr";
MusicCategory = "lidarr";
OlderTvPriority = (int)RTorrentPriority.Normal;
RecentTvPriority = (int)RTorrentPriority.Normal;
}
@ -50,7 +50,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public string Password { get; set; }
[FieldDefinition(6, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional.")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(7, Label = "Directory", Type = FieldType.Textbox, Advanced = true, HelpText = "Optional location to put downloads in, leave blank to use the default rTorrent location")]
public string TvDirectory { get; set; }

@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
protected override string AddFromMagnetLink(RemoteAlbum remoteAlbum, string hash, string magnetLink)
{
_proxy.AddTorrentFromUrl(magnetLink, Settings);
_proxy.SetTorrentLabel(hash, Settings.TvCategory, Settings);
_proxy.SetTorrentLabel(hash, Settings.MusicCategory, Settings);
var isRecentEpisode = remoteAlbum.IsRecentAlbum();
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
protected override string AddFromTorrentFile(RemoteAlbum remoteAlbum, string hash, string filename, byte[] fileContent)
{
_proxy.AddTorrentFromFile(filename, fileContent, Settings);
_proxy.SetTorrentLabel(hash, Settings.TvCategory, Settings);
_proxy.SetTorrentLabel(hash, Settings.MusicCategory, Settings);
var isRecentEpisode = remoteAlbum.IsRecentAlbum();
@ -82,7 +82,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
foreach (var torrent in torrents)
{
if (torrent.Label != Settings.TvCategory)
if (torrent.Label != Settings.MusicCategory)
{
continue;
}
@ -146,7 +146,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
{
List<UTorrentTorrent> torrents;
var cacheKey = string.Format("{0}:{1}:{2}", Settings.Host, Settings.Port, Settings.TvCategory);
var cacheKey = string.Format("{0}:{1}:{2}", Settings.Host, Settings.Port, Settings.MusicCategory);
var cache = _torrentCache.Find(cacheKey);
var response = _proxy.GetTorrents(cache == null ? null : cache.CacheID, Settings);
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
if (config.GetValueOrDefault("dir_add_label") == "true")
{
destDir = destDir + Settings.TvCategory;
destDir = destDir + Settings.MusicCategory;
}
}

@ -11,7 +11,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
{
RuleFor(c => c.Host).ValidHost();
RuleFor(c => c.Port).InclusiveBetween(1, 65535);
RuleFor(c => c.TvCategory).NotEmpty();
RuleFor(c => c.MusicCategory).NotEmpty();
}
}
@ -23,7 +23,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
{
Host = "localhost";
Port = 8080;
TvCategory = "lidarr";
MusicCategory = "lidarr";
}
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Lidarr avoids conflicts with unrelated downloads, but it's optional")]
public string TvCategory { get; set; }
public string MusicCategory { get; set; }
[FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentTvPriority { get; set; }

Loading…
Cancel
Save