mirror of https://github.com/Radarr/Radarr
Renamed some settings, added 2nd priority for sab
New: Separated priorities for new and old episodes when sent to SABnzbd
This commit is contained in:
parent
22dc51a52f
commit
eddbd4a97b
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<PostDownloadProvider>().Setup(s => s.ProcessDropFolder(path));
|
||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, new { Path = path });
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.SabDropDirectory, Times.Never());
|
||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -52,10 +52,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
var path = @"C:\Test\Unsorted TV";
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.SabDropDirectory).Returns(path);
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.SabDropDirectory, Times.Once());
|
||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
var path = @"C:\Test\Unsorted TV";
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.SabDropDirectory).Returns(path);
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
||||
|
||||
Mocker.GetMock<PostDownloadProvider>().Verify(s => s.ProcessDropFolder(path), Times.Once());
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
[Test]
|
||||
public void DownloadNzb_should_download_file_if_it_doesnt_exist()
|
||||
{
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title).Should().BeTrue();
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once());
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
{
|
||||
WithExistingFile();
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title).Should().BeTrue();
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
{
|
||||
WithFailedDownload();
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title).Should().BeFalse();
|
||||
Mocker.Resolve<BlackholeProvider>().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<BlackholeProvider>().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
nzbPath = pneumaticFolder + title + ".nzb";
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.SabDropDirectory).Returns(sabDrop);
|
||||
Mocker.GetMock<ConfigProvider>().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<PneumaticProvider>().DownloadNzb(nzbUrl, title).Should().BeTrue();
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once());
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
{
|
||||
WithExistingFile();
|
||||
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title).Should().BeTrue();
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
|||
{
|
||||
WithFailedDownload();
|
||||
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title).Should().BeFalse();
|
||||
Mocker.Resolve<PneumaticProvider>().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<PneumaticProvider>().DownloadNzb(nzbUrl, "30 Rock - Season 1").Should().BeFalse();
|
||||
Mocker.Resolve<PneumaticProvider>().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<PneumaticProvider>().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
}
|
||||
|
|
|
@ -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<SabProvider>().DownloadNzb(url, title).Should().BeTrue();
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -66,7 +67,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
|
||||
|
||||
//Act
|
||||
bool result = Mocker.Resolve<SabProvider>().DownloadNzb("http://www.newzbin.com/browse/post/6107863/nzb", title);
|
||||
bool result = Mocker.Resolve<SabProvider>().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<ApplicationException>(() => Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeFalse());
|
||||
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeFalse());
|
||||
//ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
||||
|
@ -216,8 +217,52 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadString(It.IsAny<String>())).Throws(new WebException());
|
||||
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeFalse();
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeFalse();
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
.SetupGet(s => s.SabRecentTvPriority)
|
||||
.Returns(SabPriorityType.High);
|
||||
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
.SetupGet(s => s.SabBacklogTvPriority)
|
||||
.Returns(SabPriorityType.Low);
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.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<SabProvider>().DownloadNzb(url, title, true).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.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<ConfigProvider>()
|
||||
.SetupGet(s => s.SabRecentTvPriority)
|
||||
.Returns(SabPriorityType.High);
|
||||
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
.SetupGet(s => s.SabBacklogTvPriority)
|
||||
.Returns(SabPriorityType.Low);
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.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<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,22 +59,22 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
private void WithSuccessfullAdd()
|
||||
{
|
||||
Mocker.GetMock<SabProvider>()
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<BlackholeProvider>()
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
private void WithFailedAdd()
|
||||
{
|
||||
Mocker.GetMock<SabProvider>()
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<BlackholeProvider>()
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
|
||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
||||
.Returns(false);
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
//Assert
|
||||
Mocker.GetMock<SabProvider>()
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()), Times.Once());
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false), Times.Once());
|
||||
|
||||
Mocker.GetMock<BlackholeProvider>()
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()), Times.Never());
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false), Times.Never());
|
||||
|
||||
Mocker.GetMock<HistoryProvider>()
|
||||
.Verify(s => s.Add(It.Is<History>(h => h.EpisodeId == 12 && h.SeriesId == 5)), Times.Once());
|
||||
|
@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
//Assert
|
||||
Mocker.GetMock<SabProvider>()
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()), Times.Never());
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false), Times.Never());
|
||||
|
||||
Mocker.GetMock<BlackholeProvider>()
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()), Times.Once());
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false), Times.Once());
|
||||
|
||||
Mocker.GetMock<HistoryProvider>()
|
||||
.Verify(s => s.Add(It.Is<History>(h => h.EpisodeId == 12 && h.SeriesId == 5)), Times.Once());
|
||||
|
|
|
@ -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 + "')");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Jobs
|
|||
dropFolder = options.Path;
|
||||
|
||||
else
|
||||
dropFolder = _configProvider.SabDropDirectory;
|
||||
dropFolder = _configProvider.DownloadClientTvDirectory;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(dropFolder))
|
||||
{
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
<Compile Include="Datastore\MigrationLogger.cs" />
|
||||
<Compile Include="Datastore\MigrationsHelper.cs" />
|
||||
<Compile Include="Datastore\CustomeMapper.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121122.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121016.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121012.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20120919.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))
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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<PendingProcessingModel>();
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -45,10 +45,15 @@
|
|||
</label>
|
||||
@Html.DropDownListFor(m => m.SabTvCategory, Model.SabTvCategorySelectList, new { @class = "inputClass selectClass" })
|
||||
|
||||
<label class="labelClass">@Html.LabelFor(m => m.SabTvPriority)
|
||||
<span class="small">@Html.DescriptionFor(m => m.SabTvPriority)</span>
|
||||
<label class="labelClass">@Html.LabelFor(m => m.SabBacklogTvPriority)
|
||||
<span class="small">@Html.DescriptionFor(m => m.SabBacklogTvPriority)</span>
|
||||
</label>
|
||||
@Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList, new { @class = "inputClass selectClass" })
|
||||
@Html.DropDownListFor(m => m.SabBacklogTvPriority, Model.PrioritySelectList, new { @class = "inputClass selectClass" })
|
||||
|
||||
<label class="labelClass">@Html.LabelFor(m => m.SabRecentTvPriority)
|
||||
<span class="small">@Html.DescriptionFor(m => m.SabRecentTvPriority)</span>
|
||||
</label>
|
||||
@Html.DropDownListFor(m => m.SabRecentTvPriority, Model.PrioritySelectList, new { @class = "inputClass selectClass" })
|
||||
|
||||
<label class="labelClass">Test SABnzbd
|
||||
<span class="small">Test SABnzbd settings</span>
|
||||
|
|
Loading…
Reference in New Issue