1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

removed backlog from server

This commit is contained in:
Keivan Beigi 2013-07-03 18:00:46 -07:00 committed by kay.one
parent 459c95d85e
commit 50ee2ee357
20 changed files with 29 additions and 108 deletions

View File

@ -36,7 +36,6 @@ public class SeriesResource : RestResource
//Editing Only
public Boolean SeasonFolder { get; set; }
public Boolean Monitored { get; set; }
public BacklogSettingType BacklogSetting { get; set; }
public DateTime? CustomStartDate { get; set; }
public Boolean UseSceneNumbering { get; set; }

View File

@ -39,7 +39,7 @@ private void WithFailedDownload()
[Test]
public void DownloadNzb_should_download_file_if_it_doesnt_exist()
{
Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Subject.DownloadNzb(nzbUrl, title).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath), Times.Once());
}
@ -49,7 +49,7 @@ public void DownloadNzb_not_download_file_if_it_doesn_exist()
{
WithExistingFile();
Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Subject.DownloadNzb(nzbUrl, title).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
}
@ -59,7 +59,7 @@ public void should_return_false_on_failed_download()
{
WithFailedDownload();
Subject.DownloadNzb(nzbUrl, title, false).Should().BeFalse();
Subject.DownloadNzb(nzbUrl, title).Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
@ -70,7 +70,7 @@ 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");
Subject.DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
Subject.DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}

View File

@ -20,7 +20,6 @@ public void Setup()
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
fakeConfig.SetupGet(c => c.NzbgetPassword).Returns("pass");
fakeConfig.SetupGet(c => c.NzbgetTvCategory).Returns("TV");
fakeConfig.SetupGet(c => c.NzbgetBacklogTvPriority).Returns(PriorityType.Normal);
fakeConfig.SetupGet(c => c.NzbgetRecentTvPriority).Returns(PriorityType.High);
}
@ -44,7 +43,7 @@ public void should_add_item_to_queue()
.Returns("{\"version\": \"1.1\",\"result\": true}");
Mocker.Resolve<NzbgetClient>()
.DownloadNzb(url, title, false)
.DownloadNzb(url, title)
.Should()
.BeTrue();
}
@ -54,7 +53,7 @@ public void should_throw_when_error_is_returned()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Mocker.Resolve<NzbgetClient>().DownloadNzb("http://www.nzbdrone.com", "30 Rock - S01E01 - Pilot [HDTV-720p]", false));
Assert.Throws<ApplicationException>(() => Mocker.Resolve<NzbgetClient>().DownloadNzb("http://www.nzbdrone.com", "30 Rock - S01E01 - Pilot [HDTV-720p]"));
}
}
}

View File

@ -20,7 +20,6 @@ public void Setup()
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
fakeConfig.SetupGet(c => c.NzbgetPassword).Returns("pass");
fakeConfig.SetupGet(c => c.NzbgetTvCategory).Returns("TV");
fakeConfig.SetupGet(c => c.NzbgetBacklogTvPriority).Returns(PriorityType.Normal);
fakeConfig.SetupGet(c => c.NzbgetRecentTvPriority).Returns(PriorityType.High);
}

View File

@ -42,7 +42,7 @@ private void WithFailedDownload()
[Test]
public void should_download_file_if_it_doesnt_exist()
{
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once());
}
@ -52,7 +52,7 @@ public void should_not_download_file_if_it_doesn_exist()
{
WithExistingFile();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
}
@ -62,7 +62,7 @@ public void should_return_false_on_failed_download()
{
WithFailedDownload();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, title).Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
@ -70,7 +70,7 @@ public void should_return_false_on_failed_download()
[Test]
public void should_skip_if_full_season_download()
{
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, "30 Rock - Season 1", false).Should().BeFalse();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, "30 Rock - Season 1").Should().BeFalse();
}
[Test]
@ -79,7 +79,7 @@ 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<PneumaticClient>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
Mocker.Resolve<PneumaticClient>().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}

View File

@ -45,14 +45,14 @@ public void add_url_should_format_request_properly()
.Returns("{ \"status\": true }");
Subject.DownloadNzb(URL, TITLE, false).Should().BeTrue();
Subject.DownloadNzb(URL, TITLE).Should().BeTrue();
}
[Test]
public void add_by_url_should_detect_and_handle_sab_errors()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Subject.DownloadNzb(URL, TITLE, false).Should().BeFalse());
Assert.Throws<ApplicationException>(() => Subject.DownloadNzb(URL, TITLE).Should().BeFalse());
}
[Test]
@ -186,7 +186,7 @@ public void should_return_false_when_WebException_is_thrown()
Mocker.GetMock<IHttpProvider>()
.Setup(s => s.DownloadString(It.IsAny<String>())).Throws(new WebException());
Subject.DownloadNzb(URL, TITLE, false).Should().BeFalse();
Subject.DownloadNzb(URL, TITLE).Should().BeFalse();
ExceptionVerification.ExpectedErrors(1);
}
@ -197,41 +197,17 @@ public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_tru
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);
Mocker.GetMock<IHttpProvider>()
.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 }");
Subject.DownloadNzb(URL, TITLE, true).Should().BeTrue();
Subject.DownloadNzb(URL, TITLE).Should().BeTrue();
Mocker.GetMock<IHttpProvider>()
.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<IConfigService>()
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);
Mocker.GetMock<IHttpProvider>()
.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 }");
Subject.DownloadNzb(URL, TITLE, false).Should().BeTrue();
Mocker.GetMock<IHttpProvider>()
.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());
}
}
}

View File

@ -37,14 +37,14 @@ public void Setup()
private void WithSuccessfulAdd()
{
Mocker.GetMock<IDownloadClient>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
.Returns(true);
}
private void WithFailedAdd()
{
Mocker.GetMock<IDownloadClient>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()))
.Returns(false);
}
@ -66,7 +66,7 @@ public void Download_report_should_grab_using_client()
Subject.DownloadReport(_parseResult);
Mocker.GetMock<IDownloadClient>()
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Once());
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>()), Times.Once());
}
[Test]

View File

@ -102,13 +102,6 @@ public String SabTvCategory
set { SetValue("SabTvCategory", value); }
}
public SabPriorityType SabBacklogTvPriority
{
get { return GetValueEnum("SabBacklogTvPriority", SabPriorityType.Default); }
set { SetValue("SabBacklogTvPriority", value); }
}
public SabPriorityType SabRecentTvPriority
{
get { return GetValueEnum("SabRecentTvPriority", SabPriorityType.Default); }
@ -142,12 +135,6 @@ public string UpdateUrl
set { SetValue("UpdateUrl", value); }
}
public bool EnableBacklogSearching
{
get { return GetValueBoolean("EnableBacklogSearching"); }
set { SetValue("EnableBacklogSearching", value); }
}
public bool AutoIgnorePreviouslyDownloadedEpisodes
{
get { return GetValueBoolean("AutoIgnorePreviouslyDownloadedEpisodes"); }
@ -257,13 +244,6 @@ public Int32 NzbgetPriority
set { SetValue("NzbgetPriority", value); }
}
public PriorityType NzbgetBacklogTvPriority
{
get { return GetValueEnum("NzbgetBacklogTvPriority", PriorityType.Normal); }
set { SetValue("NzbgetBacklogTvPriority", value); }
}
public PriorityType NzbgetRecentTvPriority
{
get { return GetValueEnum("NzbgetRecentTvPriority", PriorityType.Normal); }

View File

@ -17,7 +17,6 @@ public interface IConfigService
String SabUsername { get; set; }
String SabPassword { get; set; }
String SabTvCategory { get; set; }
SabPriorityType SabBacklogTvPriority { get; set; }
SabPriorityType SabRecentTvPriority { get; set; }
String DownloadedEpisodesFolder { get; set; }
bool UseSeasonFolder { get; set; }
@ -40,11 +39,10 @@ public interface IConfigService
Int32 NzbgetPort { get; set; }
String NzbgetTvCategory { get; set; }
Int32 NzbgetPriority { get; set; }
PriorityType NzbgetBacklogTvPriority { get; set; }
PriorityType NzbgetRecentTvPriority { get; set; }
string NzbRestrictions { get; set; }
string GetValue(string key, object defaultValue, bool persist = false);
void SetValue(string key, string value);
void SaveValues(Dictionary<string, object> configValues);
}
}
}

View File

@ -4,9 +4,7 @@
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Model;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download.Clients
@ -34,7 +32,7 @@ public bool IsInQueue(RemoteEpisode newEpisode)
throw new NotImplementedException();
}
public bool DownloadNzb(string url, string title, bool recentlyAired)
public bool DownloadNzb(string url, string title)
{
try
{

View File

@ -21,12 +21,12 @@ public NzbgetClient(IConfigService configService, IHttpProvider httpProvider, Lo
_logger = logger;
}
public virtual bool DownloadNzb(string url, string title, bool recentlyAired)
public virtual bool DownloadNzb(string url, string title)
{
try
{
string cat = _configService.NzbgetTvCategory;
int priority = recentlyAired ? (int)_configService.NzbgetRecentTvPriority : (int)_configService.NzbgetBacklogTvPriority;
int priority = (int)_configService.NzbgetRecentTvPriority;
var command = new JsonRequest
{

View File

@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Model;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download.Clients
@ -31,7 +25,7 @@ public PneumaticClient(IConfigService configService, IHttpProvider httpProvider,
_diskProvider = diskProvider;
}
public virtual bool DownloadNzb(string url, string title, bool recentlyAired)
public virtual bool DownloadNzb(string url, string title)
{
try
{

View File

@ -24,7 +24,7 @@ public SabRequestBuilder(IConfigService configService)
public IRestRequest AddToQueueRequest(RemoteEpisode remoteEpisode)
{
string cat = _configService.SabTvCategory;
int priority = remoteEpisode.IsRecentEpisode() ? (int)_configService.SabRecentTvPriority : (int)_configService.SabBacklogTvPriority;
int priority = (int)_configService.SabRecentTvPriority;
string name = remoteEpisode.Report.NzbUrl.Replace("&", "%26");
string nzbName = HttpUtility.UrlEncode(remoteEpisode.Report.Title);
@ -64,12 +64,12 @@ public SabnzbdClient(IConfigService configService, IHttpProvider httpProvider, L
_logger = logger;
}
public virtual bool DownloadNzb(string url, string title, bool recentlyAired)
public virtual bool DownloadNzb(string url, string title)
{
try
{
string cat = _configService.SabTvCategory;
int priority = recentlyAired ? (int)_configService.SabRecentTvPriority : (int)_configService.SabBacklogTvPriority;
int priority =(int)_configService.SabRecentTvPriority ;
string name = url.Replace("&", "%26");
string nzbName = HttpUtility.UrlEncode(title);

View File

@ -30,7 +30,7 @@ public bool DownloadReport(RemoteEpisode remoteEpisode)
var provider = _downloadClientProvider.GetDownloadClient();
bool success = provider.DownloadNzb(remoteEpisode.Report.NzbUrl, downloadTitle, remoteEpisode.IsRecentEpisode());
bool success = provider.DownloadNzb(remoteEpisode.Report.NzbUrl, downloadTitle);
if (success)
{

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Core.Download
{
public interface IDownloadClient
{
bool DownloadNzb(string url, string title, bool recentlyAired);
bool DownloadNzb(string url, string title);
IEnumerable<QueueItem> GetQueue();
}

View File

@ -1,9 +0,0 @@
namespace NzbDrone.Core.Model
{
public enum BacklogSettingType
{
Inherit = 0,
Enable = 1,
Disable = 2
}
}

View File

@ -350,7 +350,6 @@
<Compile Include="Instrumentation\LogService.cs" />
<Compile Include="Instrumentation\DatabaseTarget.cs" />
<Compile Include="Model\AtomicParsleyTitleType.cs" />
<Compile Include="Model\BacklogSettingType.cs" />
<Compile Include="Model\MediaInfoModel.cs" />
<Compile Include="Download\Clients\Nzbget\EnqueueResponse.cs" />
<Compile Include="Download\Clients\Nzbget\ErrorModel.cs" />

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Parser.Model
@ -8,16 +6,11 @@ namespace NzbDrone.Core.Parser.Model
public class RemoteEpisode
{
public ReportInfo Report { get; set; }
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; }
public Series Series { get; set; }
public List<Episode> Episodes { get; set; }
public bool IsRecentEpisode()
{
return Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
}
}
}

View File

@ -2,9 +2,7 @@
using System.Collections.Generic;
using Marr.Data;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Model;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.RootFolders;
namespace NzbDrone.Core.Tv
@ -31,7 +29,6 @@ public Series()
public int Runtime { get; set; }
public List<MediaCover.MediaCover> Images { get; set; }
public SeriesTypes SeriesType { get; set; }
public BacklogSettingType BacklogSetting { get; set; }
public string Network { get; set; }
public DateTime? CustomStartDate { get; set; }
public bool UseSceneNumbering { get; set; }

View File

@ -80,7 +80,6 @@ public Series AddSeries(Series newSeries)
newSeries.CleanTitle = Parser.Parser.CleanSeriesTitle(newSeries.Title);
newSeries.SeasonFolder = _configService.UseSeasonFolder;
newSeries.BacklogSetting = BacklogSettingType.Inherit;
_seriesRepository.Insert(newSeries);
_messageAggregator.PublishEvent(new SeriesAddedEvent(newSeries));
@ -99,7 +98,6 @@ public void UpdateFromSeriesEditor(IList<Series> editedSeries)
series.QualityProfileId = edited.QualityProfileId;
series.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder;
series.BacklogSetting = edited.BacklogSetting;
//series.Path = edited.Path;
series.CustomStartDate = edited.CustomStartDate;