Removed CustomStartDate
This commit is contained in:
parent
e706e148fd
commit
7689b50dee
|
@ -35,7 +35,6 @@ namespace NzbDrone.Api.Series
|
||||||
//Editing Only
|
//Editing Only
|
||||||
public Boolean SeasonFolder { get; set; }
|
public Boolean SeasonFolder { get; set; }
|
||||||
public Boolean Monitored { get; set; }
|
public Boolean Monitored { get; set; }
|
||||||
public DateTime? CustomStartDate { get; set; }
|
|
||||||
|
|
||||||
public Boolean UseSceneNumbering { get; set; }
|
public Boolean UseSceneNumbering { get; set; }
|
||||||
public Int32 Runtime { get; set; }
|
public Int32 Runtime { get; set; }
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
|
|
||||||
public class CustomStartDateSpecificationFixture : CoreTest<CustomStartDateSpecification>
|
|
||||||
{
|
|
||||||
private CustomStartDateSpecification _customStartDateSpecification;
|
|
||||||
|
|
||||||
private RemoteEpisode parseResultMulti;
|
|
||||||
private RemoteEpisode parseResultSingle;
|
|
||||||
private Series fakeSeries;
|
|
||||||
private Episode firstEpisode;
|
|
||||||
private Episode secondEpisode;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
_customStartDateSpecification = Mocker.Resolve<CustomStartDateSpecification>();
|
|
||||||
|
|
||||||
firstEpisode = new Episode { AirDate = DateTime.Today };
|
|
||||||
secondEpisode = new Episode { AirDate = DateTime.Today };
|
|
||||||
|
|
||||||
fakeSeries = Builder<Series>.CreateNew()
|
|
||||||
.With(c => c.Monitored = true)
|
|
||||||
.With(c => c.CustomStartDate = null)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
parseResultMulti = new RemoteEpisode
|
|
||||||
{
|
|
||||||
Series = fakeSeries,
|
|
||||||
Episodes = new List<Episode> { firstEpisode, secondEpisode }
|
|
||||||
};
|
|
||||||
|
|
||||||
parseResultSingle = new RemoteEpisode
|
|
||||||
{
|
|
||||||
Series = fakeSeries,
|
|
||||||
Episodes = new List<Episode> { firstEpisode }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithFirstEpisodeLastYear()
|
|
||||||
{
|
|
||||||
firstEpisode.AirDate = DateTime.Today.AddYears(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithSecondEpisodeYear()
|
|
||||||
{
|
|
||||||
secondEpisode.AirDate = DateTime.Today.AddYears(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithAiredAfterYesterday()
|
|
||||||
{
|
|
||||||
fakeSeries.CustomStartDate = DateTime.Today.AddDays(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithAiredAfterLastWeek()
|
|
||||||
{
|
|
||||||
fakeSeries.CustomStartDate = DateTime.Today.AddDays(-7);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_single_episode()
|
|
||||||
{
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_multiple_episodes()
|
|
||||||
{
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_both_episodes_air_after_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_episode_airs_after_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_first_episode_aired_after_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
WithSecondEpisodeYear();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_second_episode_aired_after_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
WithFirstEpisodeLastYear();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_false_if_both_episodes_aired_before_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
WithFirstEpisodeLastYear();
|
|
||||||
WithSecondEpisodeYear();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_false_if_episode_aired_before_cutoff()
|
|
||||||
{
|
|
||||||
WithAiredAfterLastWeek();
|
|
||||||
WithFirstEpisodeLastYear();
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_episode_airs_the_same_day_as_the_cutoff()
|
|
||||||
{
|
|
||||||
fakeSeries.CustomStartDate = DateTime.Today;
|
|
||||||
_customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -176,7 +176,6 @@
|
||||||
<Compile Include="EpisodeParseResultTest.cs" />
|
<Compile Include="EpisodeParseResultTest.cs" />
|
||||||
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
||||||
<Compile Include="Configuration\ConfigCachingFixture.cs" />
|
<Compile Include="Configuration\ConfigCachingFixture.cs" />
|
||||||
<Compile Include="DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
|
|
||||||
<Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" />
|
<Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" />
|
||||||
<Compile Include="ProviderTests\RecycleBinProviderTests\CleanupFixture.cs" />
|
<Compile Include="ProviderTests\RecycleBinProviderTests\CleanupFixture.cs" />
|
||||||
<Compile Include="ProviderTests\RecycleBinProviderTests\EmptyFixture.cs" />
|
<Compile Include="ProviderTests\RecycleBinProviderTests\EmptyFixture.cs" />
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Tags("")]
|
||||||
|
[Migration(12)]
|
||||||
|
public class remove_custom_start_date : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
SQLiteAlter.DropColumns("Series", new[] { "CustomStartDate" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,43 +0,0 @@
|
||||||
using System.Linq;
|
|
||||||
using NLog;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
||||||
{
|
|
||||||
public class CustomStartDateSpecification : IDecisionEngineSpecification
|
|
||||||
{
|
|
||||||
private readonly Logger _logger;
|
|
||||||
|
|
||||||
public CustomStartDateSpecification(Logger logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string RejectionReason
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "Aired before configured cut-off";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject)
|
|
||||||
{
|
|
||||||
if (!subject.Series.CustomStartDate.HasValue)
|
|
||||||
{
|
|
||||||
_logger.Debug("{0} does not restrict downloads before date.", subject.Series);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subject.Episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value))
|
|
||||||
{
|
|
||||||
_logger.Debug("One or more episodes aired after cutoff, downloading.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.CustomStartDate);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -212,6 +212,7 @@
|
||||||
<Compile Include="Datastore\Migration\009_fix_renameEpisodes.cs" />
|
<Compile Include="Datastore\Migration\009_fix_renameEpisodes.cs" />
|
||||||
<Compile Include="Datastore\Migration\010_add_monitored.cs" />
|
<Compile Include="Datastore\Migration\010_add_monitored.cs" />
|
||||||
<Compile Include="Datastore\Migration\011_remove_ignored.cs" />
|
<Compile Include="Datastore\Migration\011_remove_ignored.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\012_remove_custom_start_date.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
||||||
|
@ -239,7 +240,6 @@
|
||||||
<Compile Include="DecisionEngine\Specifications\AcceptableSizeSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\AcceptableSizeSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\DownloadDecisionMaker.cs" />
|
<Compile Include="DecisionEngine\DownloadDecisionMaker.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\NotInQueueSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\NotInQueueSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\CustomStartDateSpecification.cs" />
|
|
||||||
<Compile Include="DecisionEngine\Specifications\LanguageSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\LanguageSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\MonitoredEpisodeSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\MonitoredEpisodeSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\QualityAllowedByProfileSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\QualityAllowedByProfileSpecification.cs" />
|
||||||
|
|
|
@ -31,7 +31,6 @@ namespace NzbDrone.Core.Tv
|
||||||
public List<MediaCover.MediaCover> Images { get; set; }
|
public List<MediaCover.MediaCover> Images { get; set; }
|
||||||
public SeriesTypes SeriesType { get; set; }
|
public SeriesTypes SeriesType { get; set; }
|
||||||
public string Network { get; set; }
|
public string Network { get; set; }
|
||||||
public DateTime? CustomStartDate { get; set; }
|
|
||||||
public bool UseSceneNumbering { get; set; }
|
public bool UseSceneNumbering { get; set; }
|
||||||
public string TitleSlug { get; set; }
|
public string TitleSlug { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
|
@ -95,7 +95,6 @@ namespace NzbDrone.Core.Tv
|
||||||
series.Monitored = edited.Monitored;
|
series.Monitored = edited.Monitored;
|
||||||
series.SeasonFolder = edited.SeasonFolder;
|
series.SeasonFolder = edited.SeasonFolder;
|
||||||
series.Path = edited.Path;
|
series.Path = edited.Path;
|
||||||
series.CustomStartDate = edited.CustomStartDate;
|
|
||||||
|
|
||||||
_seriesRepository.Update(series);
|
_seriesRepository.Update(series);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,9 @@
|
||||||
<option value="{{id}}">{{attributes.name}}</option>
|
<option value="{{id}}">{{attributes.name}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</select>
|
</select>
|
||||||
<span class="help-inline">
|
<span class="help-inline">
|
||||||
<i class="icon-question-sign" title="Which Quality Profile should NzbDrone use to download episodes?"/>
|
<i class="icon-question-sign" title="Which Quality Profile should NzbDrone use to download episodes?"/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue