mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Merge branch 'master' into backbone
Conflicts: NzbDrone.Web/Views/Settings/Quality.cshtml
This commit is contained in:
commit
ccccb9a4cd
Binary file not shown.
@ -596,7 +596,6 @@ public void Wombles_NzbInfoUrl_should_contain_information_string()
|
||||
WithConfiguredIndexers();
|
||||
|
||||
const string fileName = "wombles.xml";
|
||||
const string expectedString = "nzbdetails";
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
@ -635,7 +634,6 @@ public void NzbIndex_NzbInfoUrl_should_contain_information_string()
|
||||
{
|
||||
WithConfiguredIndexers();
|
||||
|
||||
const string fileName = "nzbindex.xml";
|
||||
const string expectedString = "release";
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
|
@ -44,7 +44,7 @@ public void should_not_get_sabDropDir_when_path_is_supplied()
|
||||
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 @@ public void should_get_sabDropDir_when_path_is_not_supplied()
|
||||
{
|
||||
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 @@ public void should_use_sabDropDir_when_options_Path_is_not_provided()
|
||||
{
|
||||
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());
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
@ -42,7 +43,7 @@ private void WithFailedDownload()
|
||||
[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());
|
||||
}
|
||||
@ -52,7 +53,7 @@ public void DownloadNzb_not_download_file_if_it_doesn_exist()
|
||||
{
|
||||
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());
|
||||
}
|
||||
@ -62,11 +63,20 @@ public void should_return_false_on_failed_download()
|
||||
{
|
||||
WithFailedDownload();
|
||||
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title).Should().BeFalse();
|
||||
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_illegal_characters_in_title()
|
||||
{
|
||||
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, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
@ -29,7 +30,7 @@ public void Setup()
|
||||
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()
|
||||
@ -45,7 +46,7 @@ private void WithFailedDownload()
|
||||
[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());
|
||||
}
|
||||
@ -55,7 +56,7 @@ public void should_not_download_file_if_it_doesn_exist()
|
||||
{
|
||||
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());
|
||||
}
|
||||
@ -65,7 +66,7 @@ public void should_return_false_on_failed_download()
|
||||
{
|
||||
WithFailedDownload();
|
||||
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title).Should().BeFalse();
|
||||
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
@ -73,7 +74,18 @@ public void should_return_false_on_failed_download()
|
||||
[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]
|
||||
public void should_replace_illegal_characters_in_title()
|
||||
{
|
||||
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, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] e
|
||||
new object[] { 1, new[] { 5 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality
|
||||
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality, one different episode
|
||||
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality, one different episode
|
||||
new object[] { 4, new[] { 8 }, "Parks and Recreation", QualityTypes.WEBDL720p }, false, //Same Series, same quality
|
||||
new object[] { 4, new[] { 8 }, "Parks and Recreation", QualityTypes.WEBDL720p, false }, //Same Series, same quality
|
||||
};
|
||||
|
||||
[Test, TestCaseSource("LowerQualityCases")]
|
||||
|
@ -11,6 +11,7 @@
|
||||
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 @@ public void add_url_should_format_request_properly()
|
||||
.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 @@ public void newzbin_add_url_should_format_request_properly()
|
||||
|
||||
|
||||
//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 @@ public void add_by_url_should_detect_and_handle_sab_errors()
|
||||
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 @@ public void should_return_false_when_WebException_is_thrown()
|
||||
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 @@ private EpisodeParseResult SetupParseResult()
|
||||
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>(), It.IsAny<bool>()))
|
||||
.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>(), It.IsAny<bool>()))
|
||||
.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 @@ public void Download_report_should_send_to_sab_add_to_history_mark_as_grabbed()
|
||||
|
||||
//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>(), true), 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>(), true), 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 @@ public void should_download_nzb_to_blackhole_add_to_history_mark_as_grabbed()
|
||||
|
||||
//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>(), true), 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>(), true), Times.Once());
|
||||
|
||||
Mocker.GetMock<HistoryProvider>()
|
||||
.Verify(s => s.Add(It.Is<History>(h => h.EpisodeId == 12 && h.SeriesId == 5)), Times.Once());
|
||||
|
@ -18,6 +18,7 @@ public class PerformSearchFixture : CoreTest
|
||||
{
|
||||
private const string SCENE_NAME = "Scene Name";
|
||||
private const int SEASON_NUMBER = 5;
|
||||
private const int EPISODE_NUMBER = 1;
|
||||
private const int PARSE_RESULT_COUNT = 10;
|
||||
|
||||
private Mock<IndexerBase> _episodeIndexer1;
|
||||
@ -170,26 +171,13 @@ private void VerifyFetchSeason(Times times)
|
||||
public void PerformSearch_should_search_all_enabled_providers()
|
||||
{
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformEpisodeSearch(_series, SEASON_NUMBER, _episodes.First().EpisodeNumber);
|
||||
|
||||
//Assert
|
||||
VerifyFetchEpisode(Times.Once());
|
||||
result.Should().HaveCount(PARSE_RESULT_COUNT * 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PerformSearch_should_look_for_scene_name_to_search()
|
||||
{
|
||||
WithSceneName();
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, 1, _episodes);
|
||||
|
||||
//Assert
|
||||
Mocker.GetMock<SceneMappingProvider>().Verify(c => c.GetSceneName(_series.SeriesId),
|
||||
Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void broken_indexer_should_not_block_other_indexers()
|
||||
{
|
||||
@ -197,7 +185,7 @@ public void broken_indexer_should_not_block_other_indexers()
|
||||
WithTwoGoodOneBrokenIndexer();
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformEpisodeSearch(_series, SEASON_NUMBER, EPISODE_NUMBER);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(PARSE_RESULT_COUNT * 2);
|
||||
@ -215,7 +203,7 @@ public void broken_indexer_should_not_block_other_indexers()
|
||||
public void PerformSearch_for_episode_should_call_FetchEpisode()
|
||||
{
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformEpisodeSearch(_series, SEASON_NUMBER, EPISODE_NUMBER);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(PARSE_RESULT_COUNT * 2);
|
||||
@ -230,7 +218,7 @@ public void PerformSearch_for_daily_episode_should_call_FetchEpisode()
|
||||
_series.IsDaily = true;
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformDailyEpisodeSearch(_series, _episodes.First());
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(PARSE_RESULT_COUNT * 2);
|
||||
@ -244,7 +232,7 @@ public void PerformSearch_for_partial_season_should_call_FetchPartialSeason()
|
||||
With30Episodes();
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformPartialSeasonSearch(_series, SEASON_NUMBER, new List<int>{0, 1, 2, 3});
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(80);
|
||||
@ -257,7 +245,7 @@ public void PerformSearch_for_season_should_call_FetchSeason()
|
||||
WithNullEpisodes();
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSeasonSearch(_series, SEASON_NUMBER);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(20);
|
||||
@ -271,7 +259,7 @@ public void PerformSearch_should_return_empty_list_when_results_from_indexers_ar
|
||||
WithNullIndexers();
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
var result = Mocker.Resolve<SearchProvider>().PerformEpisodeSearch(_series, SEASON_NUMBER, EPISODE_NUMBER);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(0);
|
||||
@ -283,10 +271,9 @@ public void should_use_scene_name_to_search_for_episode_when_avilable()
|
||||
{
|
||||
WithSceneName();
|
||||
|
||||
Mocker.Resolve<SearchProvider>().PerformSearch(MockNotification, _series, SEASON_NUMBER, _episodes);
|
||||
Mocker.Resolve<SearchProvider>().PerformEpisodeSearch(_series, SEASON_NUMBER, EPISODE_NUMBER);
|
||||
|
||||
VerifyFetchEpisodeWithSceneName(Times.Once());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
22
NzbDrone.Core/Datastore/Migrations/Migration20121122.cs
Normal file
22
NzbDrone.Core/Datastore/Migrations/Migration20121122.cs
Normal file
@ -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] = 'DownloadClientTvDirectory' WHERE [KEY] = 'SabTvDropDirectory'");
|
||||
|
||||
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 @@ public virtual void Start(ProgressNotification notification, dynamic options)
|
||||
dropFolder = options.Path;
|
||||
|
||||
else
|
||||
dropFolder = _configProvider.SabDropDirectory;
|
||||
dropFolder = _configProvider.DownloadClientTvDirectory;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(dropFolder))
|
||||
{
|
||||
|
@ -230,6 +230,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" />
|
||||
|
@ -220,8 +220,7 @@ private static EpisodeParseResult ParseMatchCollection(MatchCollection matchColl
|
||||
}
|
||||
|
||||
parsedEpisode = new EpisodeParseResult
|
||||
{
|
||||
|
||||
{
|
||||
AirDate = new DateTime(airyear, airmonth, airday).Date,
|
||||
};
|
||||
}
|
||||
|
@ -145,18 +145,25 @@ public virtual String SabTvCategory
|
||||
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 @@ public virtual string GetValue(string key, object defaultValue, bool persist = f
|
||||
{
|
||||
EnsureCache();
|
||||
|
||||
|
||||
string dbValue;
|
||||
|
||||
if (cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue))
|
||||
|
@ -206,6 +206,7 @@ public virtual EpisodeFile MoveEpisodeFile(EpisodeFile episodeFile, bool newDown
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
Logger.Debug("Unable to apply folder permissions to: ", newFile.FullName);
|
||||
Logger.TraceException(ex.Message, ex);
|
||||
}
|
||||
|
||||
episodeFile.Path = newFile.FullName;
|
||||
|
@ -34,10 +34,12 @@ public BlackholeProvider()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool DownloadNzb(string url, string title)
|
||||
public virtual bool DownloadNzb(string url, string title, bool recentlyAired)
|
||||
{
|
||||
try
|
||||
{
|
||||
title = MediaFileProvider.CleanFilename(title);
|
||||
|
||||
var filename = Path.Combine(_configProvider.BlackholeDirectory, title + ".nzb");
|
||||
|
||||
if (_diskProvider.FileExists(filename))
|
||||
@ -64,7 +66,5 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
|
||||
{
|
||||
return !_upgradeHistorySpecification.IsSatisfiedBy(newParseResult);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ public PneumaticProvider()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool DownloadNzb(string url, string title)
|
||||
public virtual bool DownloadNzb(string url, string title, bool recentlyAired)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -44,6 +44,8 @@ public virtual bool DownloadNzb(string url, string title)
|
||||
return false;
|
||||
}
|
||||
|
||||
title = MediaFileProvider.CleanFilename(title);
|
||||
|
||||
//Save to the Pneumatic directory (The user will need to ensure its accessible by XBMC)
|
||||
var filename = Path.Combine(_configProvider.PneumaticDirectory, title + ".nzb");
|
||||
|
||||
@ -60,7 +62,7 @@ public virtual bool DownloadNzb(string url, string title)
|
||||
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 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public DownloadProvider()
|
||||
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 @@ public virtual String GetDownloadTitle(EpisodeParseResult parseResult)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&limit=100&q={1}&season{2}&ep{3}", url, seriesTitle, seasonNumber, episodeNumber));
|
||||
searchUrls.Add(String.Format("{0}&limit=100&q={1}&season={2}&ep={3}", url, seriesTitle, seasonNumber, episodeNumber));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
@ -60,7 +60,7 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&limit=100&q={1}&season{2}", url, seriesTitle, seasonNumber));
|
||||
searchUrls.Add(String.Format("{0}&limit=100&q={1}&season={2}", url, seriesTitle, seasonNumber));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
|
@ -48,7 +48,7 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&term={1}+s{2:00}e{3:00}", url, seriesTitle, seasonNumber, episodeNumber));
|
||||
searchUrls.Add(String.Format("{0}&term=(\"{1}+s{2:00}e{3:00}\",\"{1}+{2}x{3:00}\")", url, seriesTitle, seasonNumber, episodeNumber));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
@ -72,8 +72,7 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&term={1}+Season", url, seriesTitle));
|
||||
searchUrls.Add(String.Format("{0}&term={1}+S{2:00}", url, seriesTitle, seasonNumber));
|
||||
searchUrls.Add(String.Format("{0}&term=(\"{1}+Season\",\"{1}+S{2:00}\")", url, seriesTitle, seasonNumber));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
@ -85,7 +84,7 @@ protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle,
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&term={1}+S{2:00}E{3}", url, seriesTitle, seasonNumber, episodeWildcard));
|
||||
searchUrls.Add(String.Format("{0}&term=(\"{1}+S{2:00}E{3}\", \"{1}+{2}x{3}\")", url, seriesTitle, seasonNumber, episodeWildcard));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
|
@ -140,6 +140,7 @@ public virtual void CheckHostname(string url)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("Invalid address {0}, please correct the site URL.", url);
|
||||
Logger.TraceException(ex.Message, ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class SearchProvider
|
||||
{
|
||||
//Season and Episode Searching
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private readonly DownloadProvider _downloadProvider;
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
@ -25,7 +24,7 @@ public class SearchProvider
|
||||
private readonly AllowedDownloadSpecification _allowedDownloadSpecification;
|
||||
private readonly SearchHistoryProvider _searchHistoryProvider;
|
||||
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public SearchProvider(EpisodeProvider episodeProvider, DownloadProvider downloadProvider, SeriesProvider seriesProvider,
|
||||
@ -60,38 +59,63 @@ public virtual List<int> SeasonSearch(ProgressNotification notification, int ser
|
||||
|
||||
if (series == null)
|
||||
{
|
||||
_logger.Error("Unable to find an series {0} in database", seriesId);
|
||||
logger.Error("Unable to find an series {0} in database", seriesId);
|
||||
return new List<int>();
|
||||
}
|
||||
}
|
||||
|
||||
//Return false if the series is a daily series (we only support individual episode searching
|
||||
if (series.IsDaily)
|
||||
{
|
||||
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
logger.Debug("Getting episodes from database for series: {0} and season: {1}", seriesId, seasonNumber);
|
||||
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);
|
||||
|
||||
if (episodes == null || episodes.Count == 0)
|
||||
{
|
||||
logger.Warn("No episodes in database found for series: {0} and season: {1}.", seriesId, seasonNumber);
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
||||
|
||||
var reports = PerformSearch(notification, series, seasonNumber);
|
||||
List<EpisodeParseResult> reports;
|
||||
|
||||
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
if (series.UseSceneNumbering)
|
||||
{
|
||||
var sceneSeasonNumbers = episodes.Select(e => e.SceneSeasonNumber).ToList();
|
||||
var sceneEpisodeNumbers = episodes.Select(e => e.SceneEpisodeNumber).ToList();
|
||||
|
||||
if (sceneSeasonNumbers.Distinct().Count() > 1)
|
||||
{
|
||||
logger.Trace("Uses scene numbering, but multiple seasons found, skipping.");
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
reports = PerformSeasonSearch(series, sceneSeasonNumbers.First());
|
||||
|
||||
reports.Where(p => p.FullSeason && p.SeasonNumber == sceneSeasonNumbers.First()).ToList().ForEach(
|
||||
e => e.EpisodeNumbers = sceneEpisodeNumbers.ToList()
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
reports = PerformSeasonSearch(series, seasonNumber);
|
||||
|
||||
reports.Where(p => p.FullSeason && p.SeasonNumber == seasonNumber).ToList().ForEach(
|
||||
e => e.EpisodeNumbers = episodes.Select(ep => ep.EpisodeNumber).ToList()
|
||||
);
|
||||
}
|
||||
|
||||
logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
|
||||
if (reports.Count == 0)
|
||||
return new List<int>();
|
||||
|
||||
_logger.Debug("Getting episodes from database for series: {0} and season: {1}", seriesId, seasonNumber);
|
||||
var episodeNumbers = _episodeProvider.GetEpisodeNumbersBySeason(seriesId, seasonNumber);
|
||||
|
||||
if (episodeNumbers == null || episodeNumbers.Count == 0)
|
||||
{
|
||||
_logger.Warn("No episodes in database found for series: {0} and season: {1}.", seriesId, seasonNumber);
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
notification.CurrentMessage = "Processing search results";
|
||||
|
||||
reports.Where(p => p.FullSeason && p.SeasonNumber == seasonNumber).ToList().ForEach(
|
||||
e => e.EpisodeNumbers = episodeNumbers.ToList()
|
||||
);
|
||||
|
||||
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, series, seasonNumber);
|
||||
_searchHistoryProvider.Add(searchResult);
|
||||
|
||||
@ -111,18 +135,41 @@ public virtual List<int> PartialSeasonSearch(ProgressNotification notification,
|
||||
|
||||
if (series == null)
|
||||
{
|
||||
_logger.Error("Unable to find an series {0} in database", seriesId);
|
||||
logger.Error("Unable to find an series {0} in database", seriesId);
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
//Return empty list if the series is a daily series (we only support individual episode searching
|
||||
if (series.IsDaily)
|
||||
{
|
||||
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
||||
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);
|
||||
var reports = PerformSearch(notification, series, seasonNumber, episodes);
|
||||
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
|
||||
List<EpisodeParseResult> reports;
|
||||
|
||||
if (series.UseSceneNumbering)
|
||||
{
|
||||
var sceneSeasonNumbers = episodes.Select(e => e.SceneSeasonNumber).ToList();
|
||||
var sceneEpisodeNumbers = episodes.Select(e => e.SceneEpisodeNumber).ToList();
|
||||
|
||||
if (sceneSeasonNumbers.Distinct().Count() > 1)
|
||||
{
|
||||
logger.Trace("Uses scene numbering, but multiple seasons found, skipping.");
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
reports = PerformPartialSeasonSearch(series, sceneSeasonNumbers.First(), GetEpisodeNumberPrefixes(sceneEpisodeNumbers));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
reports = PerformPartialSeasonSearch(series, seasonNumber, GetEpisodeNumberPrefixes(episodes.Select(e => e.EpisodeNumber)));
|
||||
}
|
||||
|
||||
logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
|
||||
if (reports.Count == 0)
|
||||
return new List<int>();
|
||||
@ -140,40 +187,41 @@ public virtual bool EpisodeSearch(ProgressNotification notification, int episode
|
||||
|
||||
if (episode == null)
|
||||
{
|
||||
_logger.Error("Unable to find an episode {0} in database", episodeId);
|
||||
logger.Error("Unable to find an episode {0} in database", episodeId);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check to see if an upgrade is possible before attempting
|
||||
if (!_upgradePossibleSpecification.IsSatisfiedBy(episode))
|
||||
{
|
||||
_logger.Info("Search for {0} was aborted, file in disk meets or exceeds Profile's Cutoff", episode);
|
||||
logger.Info("Search for {0} was aborted, file in disk meets or exceeds Profile's Cutoff", episode);
|
||||
notification.CurrentMessage = String.Format("Skipping search for {0}, the file you have is already at cutoff", episode);
|
||||
return false;
|
||||
}
|
||||
|
||||
notification.CurrentMessage = "Looking for " + episode;
|
||||
|
||||
if (episode.Series.IsDaily && !episode.AirDate.HasValue)
|
||||
{
|
||||
_logger.Warn("AirDate is not Valid for: {0}", episode);
|
||||
notification.CurrentMessage = String.Format("Search for {0} Failed, AirDate is invalid", episode);
|
||||
return false;
|
||||
}
|
||||
List<EpisodeParseResult> reports;
|
||||
|
||||
var searchResult = new SearchHistory
|
||||
{
|
||||
SearchTime = DateTime.Now,
|
||||
SeriesId = episode.Series.SeriesId
|
||||
SeriesId = episode.Series.SeriesId,
|
||||
EpisodeId = episodeId
|
||||
};
|
||||
|
||||
var reports = PerformSearch(notification, episode.Series, episode.SeasonNumber, new List<Episode> { episode });
|
||||
|
||||
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
notification.CurrentMessage = "Processing search results";
|
||||
|
||||
if (episode.Series.IsDaily)
|
||||
{
|
||||
if (!episode.AirDate.HasValue)
|
||||
{
|
||||
logger.Warn("AirDate is not Valid for: {0}", episode);
|
||||
notification.CurrentMessage = String.Format("Search for {0} Failed, AirDate is invalid", episode);
|
||||
return false;
|
||||
}
|
||||
|
||||
reports = PerformDailyEpisodeSearch(episode.Series, episode);
|
||||
|
||||
logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
||||
notification.CurrentMessage = "Processing search results";
|
||||
|
||||
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, episode.Series, episode.AirDate.Value);
|
||||
_searchHistoryProvider.Add(searchResult);
|
||||
|
||||
@ -183,17 +231,17 @@ public virtual bool EpisodeSearch(ProgressNotification notification, int episode
|
||||
|
||||
else if (episode.Series.UseSceneNumbering)
|
||||
{
|
||||
searchResult.EpisodeId = episodeId;
|
||||
|
||||
var seasonNumber = episode.SceneSeasonNumber;
|
||||
var episodeNumber = episode.SceneEpisodeNumber;
|
||||
|
||||
if (seasonNumber == 0 || episodeNumber == 0)
|
||||
if (seasonNumber == 0 && episodeNumber == 0)
|
||||
{
|
||||
seasonNumber = episode.SeasonNumber;
|
||||
episodeNumber = episode.EpisodeNumber;
|
||||
}
|
||||
|
||||
reports = PerformEpisodeSearch(episode.Series, seasonNumber, episodeNumber);
|
||||
|
||||
searchResult.SearchHistoryItems = ProcessSearchResults(
|
||||
notification,
|
||||
reports,
|
||||
@ -211,7 +259,8 @@ public virtual bool EpisodeSearch(ProgressNotification notification, int episode
|
||||
|
||||
else
|
||||
{
|
||||
searchResult.EpisodeId = episodeId;
|
||||
reports = PerformEpisodeSearch(episode.Series, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
|
||||
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, episode.Series, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
_searchHistoryProvider.Add(searchResult);
|
||||
|
||||
@ -219,77 +268,14 @@ public virtual bool EpisodeSearch(ProgressNotification notification, int episode
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.Warn("Unable to find {0} in any of indexers.", episode);
|
||||
logger.Warn("Unable to find {0} in any of indexers.", episode);
|
||||
|
||||
if (reports.Any())
|
||||
{
|
||||
notification.CurrentMessage = String.Format("Sorry, couldn't find {0}, that matches your preferences.", episode);
|
||||
}
|
||||
else
|
||||
{
|
||||
notification.CurrentMessage = String.Format("Sorry, couldn't find {0} in any of indexers.", episode);
|
||||
}
|
||||
notification.CurrentMessage = reports.Any() ? String.Format("Sorry, couldn't find {0}, that matches your preferences.", episode)
|
||||
: String.Format("Sorry, couldn't find {0} in any of indexers.", episode);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<EpisodeParseResult> PerformSearch(ProgressNotification notification, Series series, int seasonNumber, IList<Episode> episodes = null)
|
||||
{
|
||||
//If single episode, do a single episode search, if full season then do a full season search, otherwise, do a partial search
|
||||
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
|
||||
var title = _sceneMappingProvider.GetSceneName(series.SeriesId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
{
|
||||
title = series.Title;
|
||||
}
|
||||
|
||||
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (episodes == null)
|
||||
reports.AddRange(indexer.FetchSeason(title, seasonNumber));
|
||||
|
||||
//Treat as single episode
|
||||
else if (episodes.Count == 1)
|
||||
{
|
||||
//Use SceneNumbering - Only if SceneSN and SceneEN are greater than zero
|
||||
if (series.UseSceneNumbering && episodes.First().SceneSeasonNumber > 0 && episodes.First().SceneEpisodeNumber > 0)
|
||||
reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber));
|
||||
|
||||
//Standard
|
||||
else if (!series.IsDaily)
|
||||
reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodes.First().EpisodeNumber));
|
||||
|
||||
//Daily Episode
|
||||
else
|
||||
reports.AddRange(indexer.FetchDailyEpisode(title, episodes.First().AirDate.Value));
|
||||
}
|
||||
|
||||
//Treat as Partial Season
|
||||
else
|
||||
{
|
||||
var prefixes = GetEpisodeNumberPrefixes(episodes.Select(s => s.EpisodeNumber));
|
||||
|
||||
foreach (var episodePrefix in prefixes)
|
||||
{
|
||||
reports.AddRange(indexer.FetchPartialSeason(title, seasonNumber, episodePrefix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("An error has occurred while fetching items from " + indexer.Name, e);
|
||||
}
|
||||
});
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notification, IEnumerable<EpisodeParseResult> reports, SearchHistory searchResult, Series series, int seasonNumber, int? episodeNumber = null)
|
||||
{
|
||||
var items = new List<SearchHistoryItem>();
|
||||
@ -301,7 +287,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Trace("Analysing report " + episodeParseResult);
|
||||
logger.Trace("Analysing report " + episodeParseResult);
|
||||
|
||||
var item = new SearchHistoryItem
|
||||
{
|
||||
@ -323,7 +309,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
//If series is null or doesn't match the series we're looking for return
|
||||
if (episodeParseResult.Series == null || episodeParseResult.Series.SeriesId != series.SeriesId)
|
||||
{
|
||||
_logger.Trace("Unexpected series for search: {0}. Skipping.", episodeParseResult.CleanTitle);
|
||||
logger.Trace("Unexpected series for search: {0}. Skipping.", episodeParseResult.CleanTitle);
|
||||
item.SearchError = ReportRejectionType.WrongSeries;
|
||||
continue;
|
||||
}
|
||||
@ -331,7 +317,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
//If SeasonNumber doesn't match or episode is not in the in the list in the parse result, skip the report.
|
||||
if (episodeParseResult.SeasonNumber != seasonNumber)
|
||||
{
|
||||
_logger.Trace("Season number does not match searched season number, skipping.");
|
||||
logger.Trace("Season number does not match searched season number, skipping.");
|
||||
item.SearchError = ReportRejectionType.WrongSeason;
|
||||
continue;
|
||||
}
|
||||
@ -339,7 +325,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
//If the EpisodeNumber was passed in and it is not contained in the parseResult, skip the report.
|
||||
if (episodeNumber.HasValue && !episodeParseResult.EpisodeNumbers.Contains(episodeNumber.Value))
|
||||
{
|
||||
_logger.Trace("Searched episode number is not contained in post, skipping.");
|
||||
logger.Trace("Searched episode number is not contained in post, skipping.");
|
||||
item.SearchError = ReportRejectionType.WrongEpisode;
|
||||
continue;
|
||||
}
|
||||
@ -347,7 +333,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
//Make sure we haven't already downloaded a report with this episodenumber, if we have, skip the report.
|
||||
if (searchResult.Successes.Intersect(episodeParseResult.EpisodeNumbers).Any())
|
||||
{
|
||||
_logger.Trace("Episode has already been downloaded in this search, skipping.");
|
||||
logger.Trace("Episode has already been downloaded in this search, skipping.");
|
||||
item.SearchError = ReportRejectionType.Skipped;
|
||||
continue;
|
||||
}
|
||||
@ -357,7 +343,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
item.SearchError = _allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult);
|
||||
if (item.SearchError == ReportRejectionType.None)
|
||||
{
|
||||
_logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
||||
logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
||||
try
|
||||
{
|
||||
if (_downloadProvider.DownloadReport(episodeParseResult))
|
||||
@ -375,7 +361,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("Unable to add report to download queue." + episodeParseResult, e);
|
||||
logger.ErrorException("Unable to add report to download queue." + episodeParseResult, e);
|
||||
notification.CurrentMessage = String.Format("Unable to add report to download queue. {0}", episodeParseResult);
|
||||
item.SearchError = ReportRejectionType.DownloadClientFailure;
|
||||
}
|
||||
@ -383,7 +369,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
|
||||
logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +405,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
continue;
|
||||
}
|
||||
|
||||
_logger.Trace("Analysing report " + episodeParseResult);
|
||||
logger.Trace("Analysing report " + episodeParseResult);
|
||||
|
||||
//Get the matching series
|
||||
episodeParseResult.Series = _seriesProvider.FindSeries(episodeParseResult.CleanTitle);
|
||||
@ -443,7 +429,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
item.SearchError = _allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult);
|
||||
if (item.SearchError == ReportRejectionType.None)
|
||||
{
|
||||
_logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
||||
logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
||||
try
|
||||
{
|
||||
if (_downloadProvider.DownloadReport(episodeParseResult))
|
||||
@ -462,7 +448,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("Unable to add report to download queue." + episodeParseResult, e);
|
||||
logger.ErrorException("Unable to add report to download queue." + episodeParseResult, e);
|
||||
notification.CurrentMessage = String.Format("Unable to add report to download queue. {0}", episodeParseResult);
|
||||
item.SearchError = ReportRejectionType.DownloadClientFailure;
|
||||
}
|
||||
@ -470,7 +456,7 @@ public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notific
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
|
||||
logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,5 +474,106 @@ private List<int> GetEpisodeNumberPrefixes(IEnumerable<int> episodeNumbers)
|
||||
|
||||
return results.Distinct().ToList();
|
||||
}
|
||||
|
||||
public List<EpisodeParseResult> PerformEpisodeSearch(Series series, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
var title = GetSeriesTitle(series);
|
||||
|
||||
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
||||
{
|
||||
try
|
||||
{
|
||||
reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodeNumber));
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.ErrorException(String.Format("An error has occurred while searching for {0}-S{1:00}E{2:00} from: {3}",
|
||||
series.Title, seasonNumber, episodeNumber, indexer.Name), e);
|
||||
}
|
||||
});
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
public List<EpisodeParseResult> PerformDailyEpisodeSearch(Series series, Episode episode)
|
||||
{
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
var title = GetSeriesTitle(series);
|
||||
|
||||
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.Trace("Episode {0} is a daily episode, searching as daily", episode);
|
||||
reports.AddRange(indexer.FetchDailyEpisode(title, episode.AirDate.Value));
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.ErrorException(String.Format("An error has occurred while searching for {0}-{1} from: {2}",
|
||||
series.Title, episode.AirDate, indexer.Name), e);
|
||||
}
|
||||
});
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
public List<EpisodeParseResult> PerformPartialSeasonSearch(Series series, int seasonNumber, List<int> prefixes)
|
||||
{
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
var title = GetSeriesTitle(series);
|
||||
|
||||
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var episodePrefix in prefixes)
|
||||
{
|
||||
reports.AddRange(indexer.FetchPartialSeason(title, seasonNumber, episodePrefix));
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.ErrorException(String.Format("An error has occurred while searching for {0}-S{1:00} from: {2}",
|
||||
series.Title, seasonNumber, indexer.Name), e);
|
||||
}
|
||||
});
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
public List<EpisodeParseResult> PerformSeasonSearch(Series series, int seasonNumber)
|
||||
{
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
var title = GetSeriesTitle(series);
|
||||
|
||||
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
||||
{
|
||||
try
|
||||
{
|
||||
reports.AddRange(indexer.FetchSeason(title, seasonNumber));
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.ErrorException("An error has occurred while searching for items from: " + indexer.Name, e);
|
||||
}
|
||||
});
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
public string GetSeriesTitle(Series series)
|
||||
{
|
||||
var title = _sceneMappingProvider.GetSceneName(series.SeriesId);
|
||||
|
||||
if (String.IsNullOrWhiteSpace(title))
|
||||
title = series.Title;
|
||||
|
||||
return title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,10 @@ public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episode
|
||||
EpisodeStatus = episodeStatus.ToString(),
|
||||
Quality = (quality == null ? String.Empty : quality.Quality.ToString())
|
||||
});
|
||||
var test = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Trace("Error");
|
||||
logger.TraceException("Error", ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public virtual void SendEmail(string subject, string body, bool htmlBody = false
|
||||
catch(Exception ex)
|
||||
{
|
||||
Logger.Error("Error sending email. Subject: {0}", email.Subject);
|
||||
Logger.TraceException(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,14 @@ public virtual void UpdateMappings()
|
||||
|
||||
public virtual void UpdateMappings(int seriesId)
|
||||
{
|
||||
var xemIds = _xemCommunicationProvider.GetXemSeriesIds();
|
||||
|
||||
if (!xemIds.Contains(seriesId))
|
||||
{
|
||||
_logger.Trace("Xem doesn't have a mapping for this series: {0}", seriesId);
|
||||
return;
|
||||
}
|
||||
|
||||
var series = _seriesProvider.GetSeries(seriesId);
|
||||
|
||||
if (series == null)
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using NLog;
|
||||
using NzbDrone.Services.Service.Repository;
|
||||
using Services.PetaPoco;
|
||||
|
||||
@ -11,6 +12,8 @@ public class SceneMappingProvider
|
||||
{
|
||||
private readonly IDatabase _database;
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public SceneMappingProvider(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
@ -74,6 +77,7 @@ public bool Promote(int mappingId)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.WarnException("Unable to promote scene mapping", ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -93,6 +97,7 @@ public bool PromoteAll()
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.WarnException("Unable to promote all scene mappings", ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -80,11 +80,11 @@
|
||||
<Name>NzbDrone.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NzbDrone.Test.Common\NzbDrone.Test.Common.csproj">
|
||||
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
|
||||
<Project>{caddfce0-7509-4430-8364-2074e1eefca2}</Project>
|
||||
<Name>NzbDrone.Test.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NzbDrone.Update\NzbDrone.Update.csproj">
|
||||
<Project>{4CCC53CD-8D5E-4CC4-97D2-5C9312AC2BD7}</Project>
|
||||
<Project>{4ccc53cd-8d5e-4cc4-97d2-5c9312ac2bd7}</Project>
|
||||
<Name>NzbDrone.Update</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Web.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.DownloadClients;
|
||||
@ -21,6 +22,8 @@ public class CommandController : Controller
|
||||
private readonly XbmcProvider _xbmcProvider;
|
||||
private readonly PlexProvider _plexProvider;
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public CommandController(JobProvider jobProvider, SabProvider sabProvider,
|
||||
SmtpProvider smtpProvider, TwitterProvider twitterProvider,
|
||||
EpisodeProvider episodeProvider, GrowlProvider growlProvider,
|
||||
@ -133,6 +136,7 @@ public JsonResult RegisterGrowl(string host, string password)
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.TraceException(ex.Message, ex);
|
||||
return JsonNotificationResult.Oops("Couldn't register and test Growl");
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public ActionResult Details(int searchId)
|
||||
Success = s.Success,
|
||||
SearchError = s.SearchError.AddSpacesToEnum().Replace("None", "Grabbed"),
|
||||
Quality = s.Quality.ToString(),
|
||||
QualityInt = (int)s.Quality,
|
||||
QualityInt = s.Quality.Weight,
|
||||
Proper = s.Proper,
|
||||
Age = s.Age,
|
||||
Size = s.Size.ToBestFileSize(1),
|
||||
@ -68,7 +68,7 @@ public JsonResult ForceDownload(int id)
|
||||
{
|
||||
_searchHistoryProvider.ForceDownload(id);
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Success", "Requested episode has been sent to download client");
|
||||
}
|
||||
|
||||
public string GetDisplayName(SearchHistory searchResult)
|
||||
|
@ -140,8 +140,9 @@ public ActionResult DownloadClient()
|
||||
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,
|
||||
@ -173,7 +174,7 @@ public ActionResult Quality()
|
||||
Bluray1080pMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 7).MaxSize
|
||||
};
|
||||
|
||||
ViewData["Profiles"] = profiles;
|
||||
ViewData["Profiles"] = profiles.Select(s => s.QualityProfileId).ToList();
|
||||
|
||||
return View(model);
|
||||
}
|
||||
@ -269,13 +270,15 @@ public PartialViewResult AddProfile()
|
||||
Cutoff = QualityTypes.Unknown
|
||||
};
|
||||
|
||||
qualityProfile.QualityProfileId = _qualityProvider.Add(qualityProfile);
|
||||
var qualityProfileId = _qualityProvider.Add(qualityProfile);
|
||||
|
||||
return GetQualityProfileView(qualityProfile);
|
||||
return GetQualityProfileView(qualityProfileId);
|
||||
}
|
||||
|
||||
public PartialViewResult GetQualityProfileView(QualityProfile profile)
|
||||
public PartialViewResult GetQualityProfileView(int profileId)
|
||||
{
|
||||
var profile = _qualityProvider.Get(profileId);
|
||||
|
||||
var model = new QualityProfileModel();
|
||||
model.QualityProfileId = profile.QualityProfileId;
|
||||
model.Name = profile.Name;
|
||||
@ -454,8 +457,9 @@ public JsonResult SaveDownloadClient(DownloadClientSettingsModel data)
|
||||
_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 @@ public string InsertConfigAjax(string key, string value)
|
||||
//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 @@ public class DownloadClientSettingsModel
|
||||
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")]
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
function actionColumn(source, type, val) {
|
||||
if (type === 'display' || type === 'filter') {
|
||||
return '<a href="/SearchHistory/ForceDownload/' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><i class="icon-plus gridAction"></i></a>';
|
||||
return '<a href="/SearchHistory/ForceDownload?id=' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><i class="icon-plus gridAction"></i></a>';
|
||||
}
|
||||
// 'sort' and 'type' both just use the raw data
|
||||
return '';
|
||||
|
@ -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
Block a user