diff --git a/NzbDrone.Core.Test/JobTests/PostDownloadScanJobFixture.cs b/NzbDrone.Core.Test/JobTests/PostDownloadScanJobFixture.cs index e754d4d0d..b92ff1258 100644 --- a/NzbDrone.Core.Test/JobTests/PostDownloadScanJobFixture.cs +++ b/NzbDrone.Core.Test/JobTests/PostDownloadScanJobFixture.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock().Setup(s => s.ProcessDropFolder(path)); Mocker.Resolve().Start(MockNotification, new { Path = path }); - Mocker.GetMock().Verify(s => s.SabDropDirectory, Times.Never()); + Mocker.GetMock().Verify(s => s.DownloadClientTvDirectory, Times.Never()); } [Test] @@ -52,10 +52,10 @@ namespace NzbDrone.Core.Test.JobTests { var path = @"C:\Test\Unsorted TV"; - Mocker.GetMock().SetupGet(s => s.SabDropDirectory).Returns(path); + Mocker.GetMock().SetupGet(s => s.DownloadClientTvDirectory).Returns(path); Mocker.Resolve().Start(MockNotification, null); - Mocker.GetMock().Verify(s => s.SabDropDirectory, Times.Once()); + Mocker.GetMock().Verify(s => s.DownloadClientTvDirectory, Times.Once()); } [Test] @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.JobTests { var path = @"C:\Test\Unsorted TV"; - Mocker.GetMock().SetupGet(s => s.SabDropDirectory).Returns(path); + Mocker.GetMock().SetupGet(s => s.DownloadClientTvDirectory).Returns(path); Mocker.Resolve().Start(MockNotification, null); Mocker.GetMock().Verify(s => s.ProcessDropFolder(path), Times.Once()); diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs index ec867c3ac..af4c40858 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests [Test] public void DownloadNzb_should_download_file_if_it_doesnt_exist() { - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once()); } @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests { WithExistingFile(); - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); } @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests { WithFailedDownload(); - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeFalse(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeFalse(); ExceptionVerification.ExpectedWarns(1); } @@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]"; var expectedFilename = Path.Combine(blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb"); - Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); } diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs index 540389362..19c74d22b 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests nzbPath = pneumaticFolder + title + ".nzb"; Mocker.GetMock().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder); - Mocker.GetMock().SetupGet(c => c.SabDropDirectory).Returns(sabDrop); + Mocker.GetMock().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop); } private void WithExistingFile() @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests [Test] public void should_download_file_if_it_doesnt_exist() { - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once()); } @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests { WithExistingFile(); - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); } @@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests { WithFailedDownload(); - Mocker.Resolve().DownloadNzb(nzbUrl, title).Should().BeFalse(); + Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeFalse(); ExceptionVerification.ExpectedWarns(1); } @@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests [Test] public void should_skip_if_full_season_download() { - Mocker.Resolve().DownloadNzb(nzbUrl, "30 Rock - Season 1").Should().BeFalse(); + Mocker.Resolve().DownloadNzb(nzbUrl, "30 Rock - Season 1", false).Should().BeFalse(); } [Test] @@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]"; var expectedFilename = Path.Combine(pneumaticFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb"); - Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue(); Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); } diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs index 50d6e939d..26d7e1dce 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs @@ -11,6 +11,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.Model; +using NzbDrone.Core.Model.Sabnzbd; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.DownloadClients; using NzbDrone.Core.Repository; @@ -54,7 +55,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Returns("{ \"status\": true }"); //Act - Mocker.Resolve().DownloadNzb(url, title).Should().BeTrue(); + Mocker.Resolve().DownloadNzb(url, title, false).Should().BeTrue(); } [Test] @@ -66,7 +67,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests //Act - bool result = Mocker.Resolve().DownloadNzb("http://www.newzbin.com/browse/post/6107863/nzb", title); + bool result = Mocker.Resolve().DownloadNzb("http://www.newzbin.com/browse/post/6107863/nzb", title, false); //Assert result.Should().BeTrue(); @@ -78,7 +79,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests WithFailResponse(); //Act - Assert.Throws(() => Mocker.Resolve().DownloadNzb(url, title).Should().BeFalse()); + Assert.Throws(() => Mocker.Resolve().DownloadNzb(url, title, false).Should().BeFalse()); //ExceptionVerification.ExpectedErrors(1); } @@ -216,8 +217,52 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests Mocker.GetMock() .Setup(s => s.DownloadString(It.IsAny())).Throws(new WebException()); - Mocker.Resolve().DownloadNzb(url, title).Should().BeFalse(); + Mocker.Resolve().DownloadNzb(url, title, false).Should().BeFalse(); ExceptionVerification.ExpectedErrors(1); } + + [Test] + public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true() + { + Mocker.GetMock() + .SetupGet(s => s.SabRecentTvPriority) + .Returns(SabPriorityType.High); + + Mocker.GetMock() + .SetupGet(s => s.SabBacklogTvPriority) + .Returns(SabPriorityType.Low); + + Mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("{ \"status\": true }"); + + //Act + Mocker.Resolve().DownloadNzb(url, title, true).Should().BeTrue(); + + Mocker.GetMock() + .Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once()); + } + + [Test] + public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false() + { + Mocker.GetMock() + .SetupGet(s => s.SabRecentTvPriority) + .Returns(SabPriorityType.High); + + Mocker.GetMock() + .SetupGet(s => s.SabBacklogTvPriority) + .Returns(SabPriorityType.Low); + + Mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("{ \"status\": true }"); + + //Act + Mocker.Resolve().DownloadNzb(url, title, false).Should().BeTrue(); + + Mocker.GetMock() + .Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once()); + } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderFixture.cs index 5c224f8fb..b85e80ae3 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadProviderFixture.cs @@ -59,22 +59,22 @@ namespace NzbDrone.Core.Test.ProviderTests private void WithSuccessfullAdd() { Mocker.GetMock() - .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny())) + .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false)) .Returns(true); Mocker.GetMock() - .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny())) + .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false)) .Returns(true); } private void WithFailedAdd() { Mocker.GetMock() - .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny())) + .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false)) .Returns(false); Mocker.GetMock() - .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny())) + .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false)) .Returns(false); } @@ -92,10 +92,10 @@ namespace NzbDrone.Core.Test.ProviderTests //Assert Mocker.GetMock() - .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny()), Times.Once()); + .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false), Times.Once()); Mocker.GetMock() - .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny()), Times.Never()); + .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false), Times.Never()); Mocker.GetMock() .Verify(s => s.Add(It.Is(h => h.EpisodeId == 12 && h.SeriesId == 5)), Times.Once()); @@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests //Assert Mocker.GetMock() - .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny()), Times.Never()); + .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false), Times.Never()); Mocker.GetMock() - .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny()), Times.Once()); + .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false), Times.Once()); Mocker.GetMock() .Verify(s => s.Add(It.Is(h => h.EpisodeId == 12 && h.SeriesId == 5)), Times.Once()); diff --git a/NzbDrone.Core/Datastore/Migrations/Migration20121122.cs b/NzbDrone.Core/Datastore/Migrations/Migration20121122.cs new file mode 100644 index 000000000..4a7936b71 --- /dev/null +++ b/NzbDrone.Core/Datastore/Migrations/Migration20121122.cs @@ -0,0 +1,22 @@ +using System; +using System.Data; +using Migrator.Framework; +using NzbDrone.Common; + +namespace NzbDrone.Core.Datastore.Migrations +{ + [Migration(20121122)] + public class Migration20121122 : NzbDroneMigration + { + protected override void MainDbUpgrade() + { + Database.ExecuteNonQuery("UPDATE Config SET [KEY] = 'SabBacklogTvPriority' WHERE [KEY] = 'SabTvPriority'"); + Database.ExecuteNonQuery("UPDATE Config SET [KEY] = 'SabTvDropDirectory ' WHERE [KEY] = 'DownloadClientTvDirectory'"); + + var priority = Database.ExecuteScalar("SELECT [Value] FROM Config WHERE [Key] = 'SabBacklogTvPriority'"); + + if (priority != null) + Database.ExecuteNonQuery("INSERT INTO Config ([Key], [Value]) VALUES('SabRecentTvPriority', '" + priority + "')"); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Jobs/PostDownloadScanJob.cs b/NzbDrone.Core/Jobs/PostDownloadScanJob.cs index 4ab9b8732..57aa13f76 100644 --- a/NzbDrone.Core/Jobs/PostDownloadScanJob.cs +++ b/NzbDrone.Core/Jobs/PostDownloadScanJob.cs @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Jobs dropFolder = options.Path; else - dropFolder = _configProvider.SabDropDirectory; + dropFolder = _configProvider.DownloadClientTvDirectory; if (String.IsNullOrWhiteSpace(dropFolder)) { diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 8d3bead02..8347497cc 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -227,6 +227,7 @@ + diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 09f83adae..44800ea49 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -145,18 +145,25 @@ namespace NzbDrone.Core.Providers.Core set { SetValue("SabTvCategory", value); } } - public virtual SabPriorityType SabTvPriority + public virtual SabPriorityType SabBacklogTvPriority { - get { return (SabPriorityType)GetValueInt("SabTvPriority"); } + get { return (SabPriorityType)GetValueInt("SabBacklogTvPriority"); } - set { SetValue("SabTvPriority", (int)value); } + set { SetValue("SabBacklogTvPriority", (int)value); } } - public virtual String SabDropDirectory + public virtual SabPriorityType SabRecentTvPriority { - get { return GetValue("SabTvDropDirectory"); } + get { return (SabPriorityType)GetValueInt("SabRecentTvPriority"); } - set { SetValue("SabTvDropDirectory", value); } + set { SetValue("SabRecentTvPriority", (int)value); } + } + + public virtual String DownloadClientTvDirectory + { + get { return GetValue("DownloadClientTvDirectory"); } + + set { SetValue("DownloadClientTvDirectory", value); } } public virtual bool SortingIncludeSeriesName @@ -557,7 +564,6 @@ namespace NzbDrone.Core.Providers.Core { EnsureCache(); - string dbValue; if (cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue)) diff --git a/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs b/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs index af836cb65..3698b2f75 100644 --- a/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs +++ b/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Providers.DownloadClients { } - public virtual bool DownloadNzb(string url, string title) + public virtual bool DownloadNzb(string url, string title, bool recentlyAired) { try { diff --git a/NzbDrone.Core/Providers/DownloadClients/IDownloadClient.cs b/NzbDrone.Core/Providers/DownloadClients/IDownloadClient.cs index 1ea0d603d..1cdc2988b 100644 --- a/NzbDrone.Core/Providers/DownloadClients/IDownloadClient.cs +++ b/NzbDrone.Core/Providers/DownloadClients/IDownloadClient.cs @@ -6,6 +6,6 @@ namespace NzbDrone.Core.Providers.DownloadClients public interface IDownloadClient { bool IsInQueue(EpisodeParseResult newParseResult); - bool DownloadNzb(string url, string title); + bool DownloadNzb(string url, string title, bool recentlyAired); } } diff --git a/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs b/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs index 45d9acd2e..1e94da2a6 100644 --- a/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs +++ b/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Providers.DownloadClients { } - public virtual bool DownloadNzb(string url, string title) + public virtual bool DownloadNzb(string url, string title, bool recentlyAired) { try { @@ -62,7 +62,7 @@ namespace NzbDrone.Core.Providers.DownloadClients logger.Trace("NZB Download succeeded, saved to: {0}", filename); var contents = String.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", filename, title); - _diskProvider.WriteAllText(Path.Combine(_configProvider.SabDropDirectory, title + ".strm"), contents); + _diskProvider.WriteAllText(Path.Combine(_configProvider.DownloadClientTvDirectory, title + ".strm"), contents); return true; } diff --git a/NzbDrone.Core/Providers/DownloadClients/SabProvider.cs b/NzbDrone.Core/Providers/DownloadClients/SabProvider.cs index 252b7b2b3..9b18b5b44 100644 --- a/NzbDrone.Core/Providers/DownloadClients/SabProvider.cs +++ b/NzbDrone.Core/Providers/DownloadClients/SabProvider.cs @@ -78,12 +78,13 @@ namespace NzbDrone.Core.Providers.DownloadClients } } - public virtual bool DownloadNzb(string url, string title) + public virtual bool DownloadNzb(string url, string title, bool recentlyAired) { try { string cat = _configProvider.SabTvCategory; - int priority = (int)_configProvider.SabTvPriority; + int priority = recentlyAired ? (int)_configProvider.SabRecentTvPriority : (int)_configProvider.SabBacklogTvPriority; + string name = GetNzbName(url); string nzbName = HttpUtility.UrlEncode(title); diff --git a/NzbDrone.Core/Providers/DownloadProvider.cs b/NzbDrone.Core/Providers/DownloadProvider.cs index dde52a4e9..2df3f63d2 100644 --- a/NzbDrone.Core/Providers/DownloadProvider.cs +++ b/NzbDrone.Core/Providers/DownloadProvider.cs @@ -46,10 +46,10 @@ namespace NzbDrone.Core.Providers public virtual bool DownloadReport(EpisodeParseResult parseResult) { var downloadTitle = GetDownloadTitle(parseResult); - var provider = GetActiveDownloadClient(); + var recentEpisode = CheckIfRecentEpisode(parseResult); - bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle); + bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle, recentEpisode); if (success) { @@ -154,5 +154,14 @@ namespace NzbDrone.Core.Providers return result; } + + public virtual bool CheckIfRecentEpisode(EpisodeParseResult parseResult) + { + return parseResult.Episodes + .Where(e => e.AirDate.HasValue) + .Select(e => e.AirDate) + .OrderBy(e => e.Value) + .First().Value <= DateTime.Today.AddDays(7); + } } } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index a2f3414be..69d98ccf3 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -140,8 +140,9 @@ namespace NzbDrone.Web.Controllers SabUsername = _configProvider.SabUsername, SabPassword = _configProvider.SabPassword, SabTvCategory = tvCategory, - SabTvPriority = _configProvider.SabTvPriority, - DownloadClientDropDirectory = _configProvider.SabDropDirectory, + SabBacklogTvPriority = _configProvider.SabBacklogTvPriority, + SabRecentTvPriority = _configProvider.SabRecentTvPriority, + DownloadClientDropDirectory = _configProvider.DownloadClientTvDirectory, SabTvCategorySelectList = tvCategorySelectList, DownloadClient = (int)_configProvider.DownloadClient, BlackholeDirectory = _configProvider.BlackholeDirectory, @@ -456,8 +457,9 @@ namespace NzbDrone.Web.Controllers _configProvider.SabPassword = data.SabPassword; _configProvider.SabTvCategory = data.SabTvCategory; _configProvider.SabUsername = data.SabUsername; - _configProvider.SabTvPriority = data.SabTvPriority; - _configProvider.SabDropDirectory = data.DownloadClientDropDirectory; + _configProvider.SabBacklogTvPriority = data.SabBacklogTvPriority; + _configProvider.SabRecentTvPriority = data.SabRecentTvPriority; + _configProvider.DownloadClientTvDirectory = data.DownloadClientDropDirectory; _configProvider.BlackholeDirectory = data.BlackholeDirectory; _configProvider.DownloadClient = (DownloadClientType)data.DownloadClient; _configProvider.PneumaticDirectory = data.PneumaticDirectory; diff --git a/NzbDrone.Web/Controllers/SystemController.cs b/NzbDrone.Web/Controllers/SystemController.cs index 796fcda2c..3e08afc24 100644 --- a/NzbDrone.Web/Controllers/SystemController.cs +++ b/NzbDrone.Web/Controllers/SystemController.cs @@ -109,9 +109,9 @@ namespace NzbDrone.Web.Controllers //PostDownloadView public ActionResult PendingProcessing() { - ViewData["DropDir"] = _configProvider.SabDropDirectory; + ViewData["DropDir"] = _configProvider.DownloadClientTvDirectory; - var dropDir = _configProvider.SabDropDirectory; + var dropDir = _configProvider.DownloadClientTvDirectory; var subFolders = _diskProvider.GetDirectories(dropDir); var models = new List(); diff --git a/NzbDrone.Web/Models/DownloadClientSettingsModel.cs b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs index d193949d6..e4f04bf71 100644 --- a/NzbDrone.Web/Models/DownloadClientSettingsModel.cs +++ b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs @@ -50,9 +50,14 @@ namespace NzbDrone.Web.Models public String SabTvCategory { get; set; } [Required(ErrorMessage = "Please select a valid priority")] - [DisplayName("SABnzbd Priority")] - [Description("Priority to use when sending NZBs to SABnzbd")] - public SabPriorityType SabTvPriority { get; set; } + [DisplayName("SABnzbd Backlog Priority")] + [Description("Priority to use when sending episodes older than 7 days to SABnzbd")] + public SabPriorityType SabBacklogTvPriority { get; set; } + + [Required(ErrorMessage = "Please select a valid priority")] + [DisplayName("SABnzbd Recent Priority")] + [Description("Priority to use when sending episodes newer than 7 days to SABnzbd")] + public SabPriorityType SabRecentTvPriority { get; set; } [Required(ErrorMessage = "Required so NzbDrone can sort downloads")] [DisplayName("Download Client TV Directory")] diff --git a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml index ce18214d1..918e373fe 100644 --- a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml +++ b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml @@ -45,10 +45,15 @@ @Html.DropDownListFor(m => m.SabTvCategory, Model.SabTvCategorySelectList, new { @class = "inputClass selectClass" }) -