Renamed AiredAfter to CustomStartDate

pull/4/head
Mark McDowall 12 years ago
parent 15e4a286d1
commit a7a0a25029

@ -146,7 +146,7 @@
<Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" /> <Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" />
<Compile Include="ProviderTests\BannerProviderTest.cs" /> <Compile Include="ProviderTests\BannerProviderTest.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" /> <Compile Include="ProviderTests\DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\EpisodeAiredAfterCutoffSpecificationFixture.cs" /> <Compile Include="ProviderTests\DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpFixture.cs" /> <Compile Include="ProviderTests\DiskScanProviderTests\CleanUpFixture.cs" />
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpDropFolderFixture.cs" /> <Compile Include="ProviderTests\DiskScanProviderTests\CleanUpDropFolderFixture.cs" />
<Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" /> <Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" />

@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())) .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
.Returns(true); .Returns(true);
Mocker.GetMock<EpisodeAiredAfterCutoffSpecification>() Mocker.GetMock<CustomStartDateSpecification>()
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())) .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
.Returns(true); .Returns(true);
} }
@ -93,9 +93,9 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
.Returns(false); .Returns(false);
} }
private void WithAiredBeforeCutoff() private void WithAiredBeforeCustomStartDateCutoff()
{ {
Mocker.GetMock<EpisodeAiredAfterCutoffSpecification>() Mocker.GetMock<CustomStartDateSpecification>()
.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())) .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
.Returns(false); .Returns(false);
} }
@ -144,8 +144,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
[Test] [Test]
public void should_not_be_allowed_if_episode_aired_before_cutoff() public void should_not_be_allowed_if_episode_aired_before_cutoff()
{ {
WithAiredBeforeCutoff(); WithAiredBeforeCustomStartDateCutoff();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.EpisodeAiredBeforeCutoff); spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.AiredAfterCustomStartDate);
} }
[Test] [Test]

@ -17,9 +17,9 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
{ {
[TestFixture] [TestFixture]
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class EpisodeAiredAfterCutoffSpecificationFixture : CoreTest public class CustomStartDateSpecificationFixture : CoreTest
{ {
private EpisodeAiredAfterCutoffSpecification episodeAiredAfterCutoffSpecification; private CustomStartDateSpecification _customStartDateSpecification;
private EpisodeParseResult parseResultMulti; private EpisodeParseResult parseResultMulti;
private EpisodeParseResult parseResultSingle; private EpisodeParseResult parseResultSingle;
@ -30,11 +30,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
episodeAiredAfterCutoffSpecification = Mocker.Resolve<EpisodeAiredAfterCutoffSpecification>(); _customStartDateSpecification = Mocker.Resolve<CustomStartDateSpecification>();
fakeSeries = Builder<Series>.CreateNew() fakeSeries = Builder<Series>.CreateNew()
.With(c => c.Monitored = true) .With(c => c.Monitored = true)
.With(c => c.DownloadEpisodesAiredAfter = null) .With(c => c.CustomStartDate = null)
.Build(); .Build();
parseResultMulti = new EpisodeParseResult parseResultMulti = new EpisodeParseResult
@ -75,38 +75,38 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
private void WithAiredAfterYesterday() private void WithAiredAfterYesterday()
{ {
fakeSeries.DownloadEpisodesAiredAfter = DateTime.Today.AddDays(-1); fakeSeries.CustomStartDate = DateTime.Today.AddDays(-1);
} }
private void WithAiredAfterLastWeek() private void WithAiredAfterLastWeek()
{ {
fakeSeries.DownloadEpisodesAiredAfter = DateTime.Today.AddDays(-7); fakeSeries.CustomStartDate = DateTime.Today.AddDays(-7);
} }
[Test] [Test]
public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_single_episode() public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_single_episode()
{ {
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue();
} }
[Test] [Test]
public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_multiple_episodes() public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_multiple_episodes()
{ {
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
} }
[Test] [Test]
public void should_return_true_if_both_episodes_air_after_cutoff() public void should_return_true_if_both_episodes_air_after_cutoff()
{ {
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
} }
[Test] [Test]
public void should_return_true_if_episode_airs_after_cutoff() public void should_return_true_if_episode_airs_after_cutoff()
{ {
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue();
} }
[Test] [Test]
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
{ {
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
WithSecondEpisodeYear(); WithSecondEpisodeYear();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
} }
[Test] [Test]
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
{ {
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
WithFirstEpisodeLastYear(); WithFirstEpisodeLastYear();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue();
} }
[Test] [Test]
@ -131,7 +131,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
WithFirstEpisodeLastYear(); WithFirstEpisodeLastYear();
WithSecondEpisodeYear(); WithSecondEpisodeYear();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultMulti).Should().BeFalse(); _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeFalse();
} }
[Test] [Test]
@ -139,7 +139,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
{ {
WithAiredAfterLastWeek(); WithAiredAfterLastWeek();
WithFirstEpisodeLastYear(); WithFirstEpisodeLastYear();
episodeAiredAfterCutoffSpecification.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
} }
} }
} }

@ -0,0 +1,21 @@
using System;
using System.Data;
using Migrator.Framework;
using NzbDrone.Common;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20120919)]
public class Migration20120919 : NzbDroneMigration
{
protected override void MainDbUpgrade()
{
Database.AddColumn("Series", new Column("CustomStartDate", DbType.DateTime, ColumnProperty.Null));
Database.ExecuteNonQuery("UPDATE Series SET CustomStartDate = DownloadEpisodesAiredAfter");
Database.RemoveColumn("Series", "DownloadEpisodesAiredAfter");
}
}
}

@ -18,6 +18,6 @@ namespace NzbDrone.Core.Model
Skipped = 11, Skipped = 11,
Failure = 12, Failure = 12,
ReleaseGroupNotWanted = 13, ReleaseGroupNotWanted = 13,
EpisodeAiredBeforeCutoff = 14 AiredAfterCustomStartDate = 14
} }
} }

@ -227,6 +227,7 @@
<Compile Include="Datastore\MigrationLogger.cs" /> <Compile Include="Datastore\MigrationLogger.cs" />
<Compile Include="Datastore\MigrationsHelper.cs" /> <Compile Include="Datastore\MigrationsHelper.cs" />
<Compile Include="Datastore\CustomeMapper.cs" /> <Compile Include="Datastore\CustomeMapper.cs" />
<Compile Include="Datastore\Migrations\Migration20120919.cs" />
<Compile Include="Datastore\Migrations\Migration20120918.cs" /> <Compile Include="Datastore\Migrations\Migration20120918.cs" />
<Compile Include="Datastore\Migrations\Migration20120802.cs" /> <Compile Include="Datastore\Migrations\Migration20120802.cs" />
<Compile Include="Datastore\Migrations\Migration20120727.cs" /> <Compile Include="Datastore\Migrations\Migration20120727.cs" />
@ -292,7 +293,7 @@
<Compile Include="Model\Xbmc\IconType.cs" /> <Compile Include="Model\Xbmc\IconType.cs" />
<Compile Include="Providers\BannerProvider.cs" /> <Compile Include="Providers\BannerProvider.cs" />
<Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" /> <Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" />
<Compile Include="Providers\DecisionEngine\EpisodeAiredAfterCutoffSpecification.cs" /> <Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" />
<Compile Include="Providers\DownloadClients\PneumaticProvider.cs" /> <Compile Include="Providers\DownloadClients\PneumaticProvider.cs" />
<Compile Include="Providers\Indexer\NzbClub.cs" /> <Compile Include="Providers\Indexer\NzbClub.cs" />
<Compile Include="Providers\Indexer\NzbIndex.cs" /> <Compile Include="Providers\Indexer\NzbIndex.cs" />

@ -14,14 +14,14 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly AlreadyInQueueSpecification _alreadyInQueueSpecification; private readonly AlreadyInQueueSpecification _alreadyInQueueSpecification;
private readonly RetentionSpecification _retentionSpecification; private readonly RetentionSpecification _retentionSpecification;
private readonly AllowedReleaseGroupSpecification _allowedReleaseGroupSpecification; private readonly AllowedReleaseGroupSpecification _allowedReleaseGroupSpecification;
private readonly EpisodeAiredAfterCutoffSpecification _episodeAiredAfterCutoffSpecification; private readonly CustomStartDateSpecification _customStartDateSpecification;
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject] [Inject]
public AllowedDownloadSpecification(QualityAllowedByProfileSpecification qualityAllowedByProfileSpecification, public AllowedDownloadSpecification(QualityAllowedByProfileSpecification qualityAllowedByProfileSpecification,
UpgradeDiskSpecification upgradeDiskSpecification, AcceptableSizeSpecification acceptableSizeSpecification, UpgradeDiskSpecification upgradeDiskSpecification, AcceptableSizeSpecification acceptableSizeSpecification,
AlreadyInQueueSpecification alreadyInQueueSpecification, RetentionSpecification retentionSpecification, AlreadyInQueueSpecification alreadyInQueueSpecification, RetentionSpecification retentionSpecification,
AllowedReleaseGroupSpecification allowedReleaseGroupSpecification, EpisodeAiredAfterCutoffSpecification episodeAiredAfterCutoffSpecification) AllowedReleaseGroupSpecification allowedReleaseGroupSpecification, CustomStartDateSpecification customStartDateSpecification)
{ {
_qualityAllowedByProfileSpecification = qualityAllowedByProfileSpecification; _qualityAllowedByProfileSpecification = qualityAllowedByProfileSpecification;
_upgradeDiskSpecification = upgradeDiskSpecification; _upgradeDiskSpecification = upgradeDiskSpecification;
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Providers.DecisionEngine
_alreadyInQueueSpecification = alreadyInQueueSpecification; _alreadyInQueueSpecification = alreadyInQueueSpecification;
_retentionSpecification = retentionSpecification; _retentionSpecification = retentionSpecification;
_allowedReleaseGroupSpecification = allowedReleaseGroupSpecification; _allowedReleaseGroupSpecification = allowedReleaseGroupSpecification;
_episodeAiredAfterCutoffSpecification = episodeAiredAfterCutoffSpecification; _customStartDateSpecification = customStartDateSpecification;
} }
public AllowedDownloadSpecification() public AllowedDownloadSpecification()
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Providers.DecisionEngine
public virtual ReportRejectionType IsSatisfiedBy(EpisodeParseResult subject) public virtual ReportRejectionType IsSatisfiedBy(EpisodeParseResult subject)
{ {
if (!_qualityAllowedByProfileSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.QualityNotWanted; if (!_qualityAllowedByProfileSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.QualityNotWanted;
if (!_episodeAiredAfterCutoffSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.EpisodeAiredBeforeCutoff; if (!_customStartDateSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.AiredAfterCustomStartDate;
if (!_upgradeDiskSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.ExistingQualityIsEqualOrBetter; if (!_upgradeDiskSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.ExistingQualityIsEqualOrBetter;
if (!_retentionSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Retention; if (!_retentionSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Retention;
if (!_acceptableSizeSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Size; if (!_acceptableSizeSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Size;

@ -5,25 +5,25 @@ using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine namespace NzbDrone.Core.Providers.DecisionEngine
{ {
public class EpisodeAiredAfterCutoffSpecification public class CustomStartDateSpecification
{ {
private readonly EpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject] [Inject]
public EpisodeAiredAfterCutoffSpecification(EpisodeProvider episodeProvider) public CustomStartDateSpecification(EpisodeProvider episodeProvider)
{ {
_episodeProvider = episodeProvider; _episodeProvider = episodeProvider;
} }
public EpisodeAiredAfterCutoffSpecification() public CustomStartDateSpecification()
{ {
} }
public virtual bool IsSatisfiedBy(EpisodeParseResult subject) public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
{ {
if (!subject.Series.DownloadEpisodesAiredAfter.HasValue) if (!subject.Series.CustomStartDate.HasValue)
{ {
logger.Debug("{0} does not restrict downloads before date.", subject.Series.Title); logger.Debug("{0} does not restrict downloads before date.", subject.Series.Title);
return true; return true;
@ -31,13 +31,13 @@ namespace NzbDrone.Core.Providers.DecisionEngine
var episodes = _episodeProvider.GetEpisodesByParseResult(subject); var episodes = _episodeProvider.GetEpisodesByParseResult(subject);
if (episodes.Any(episode => episode.AirDate > subject.Series.DownloadEpisodesAiredAfter.Value)) if (episodes.Any(episode => episode.AirDate > subject.Series.CustomStartDate.Value))
{ {
logger.Debug("One or more episodes aired after cutoff, downloading."); logger.Debug("One or more episodes aired after cutoff, downloading.");
return true; return true;
} }
logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.DownloadEpisodesAiredAfter); logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.CustomStartDate);
return false; return false;
} }
} }

@ -132,7 +132,7 @@ namespace NzbDrone.Core.Providers
repoSeries.BacklogSetting = BacklogSettingType.Inherit; repoSeries.BacklogSetting = BacklogSettingType.Inherit;
if (airedAfter.HasValue) if (airedAfter.HasValue)
repoSeries.DownloadEpisodesAiredAfter = airedAfter; repoSeries.CustomStartDate = airedAfter;
_database.Insert(repoSeries); _database.Insert(repoSeries);
} }
@ -232,7 +232,7 @@ namespace NzbDrone.Core.Providers
series.SeasonFolder = edited.SeasonFolder; series.SeasonFolder = edited.SeasonFolder;
series.BacklogSetting = edited.BacklogSetting; series.BacklogSetting = edited.BacklogSetting;
series.Path = edited.Path; series.Path = edited.Path;
series.DownloadEpisodesAiredAfter = edited.DownloadEpisodesAiredAfter; series.CustomStartDate = edited.CustomStartDate;
} }
_database.UpdateMany(allSeries); _database.UpdateMany(allSeries);

@ -48,7 +48,7 @@ namespace NzbDrone.Core.Repository
public string Network { get; set; } public string Network { get; set; }
public DateTime? DownloadEpisodesAiredAfter { get; set; } public DateTime? CustomStartDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden. /// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.

@ -37,7 +37,7 @@ th .footer-control-quality {
width: 120px; width: 120px;
} }
td .aired-after { td .start-date {
width: 80px; width: 80px;
} }
@ -45,7 +45,7 @@ th .footer-control-boolean {
width: 90px; width: 90px;
} }
th .footer-control-aired-after { th .footer-control-start-date {
width: 80px; width: 80px;
} }

@ -110,7 +110,7 @@ namespace NzbDrone.Web.Controllers
} }
[HttpPost] [HttpPost]
public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId, string airedAfter) public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId, string startDate)
{ {
if (string.IsNullOrWhiteSpace(path) || String.Equals(path,"null",StringComparison.InvariantCultureIgnoreCase)) if (string.IsNullOrWhiteSpace(path) || String.Equals(path,"null",StringComparison.InvariantCultureIgnoreCase))
return JsonNotificationResult.Error("Couldn't add " + seriesName, "You need a valid root folder"); return JsonNotificationResult.Error("Couldn't add " + seriesName, "You need a valid root folder");
@ -121,20 +121,20 @@ namespace NzbDrone.Web.Controllers
//Use the created folder name when adding the series //Use the created folder name when adding the series
path = _diskProvider.CreateDirectory(path); path = _diskProvider.CreateDirectory(path);
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId, airedAfter); return AddExistingSeries(path, seriesName, seriesId, qualityProfileId, startDate);
} }
[HttpPost] [HttpPost]
[JsonErrorFilter] [JsonErrorFilter]
public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId, string airedAfter) public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId, string startDate)
{ {
if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName)) if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName))
return JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information"); return JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information");
DateTime? date = null; DateTime? date = null;
if (!String.IsNullOrWhiteSpace(airedAfter)) if (!String.IsNullOrWhiteSpace(startDate))
date = DateTime.Parse(airedAfter, null, DateTimeStyles.RoundtripKind); date = DateTime.Parse(startDate, null, DateTimeStyles.RoundtripKind);
_seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId, date); _seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId, date);
_jobProvider.QueueJob(typeof(ImportNewSeriesJob)); _jobProvider.QueueJob(typeof(ImportNewSeriesJob));

@ -73,8 +73,8 @@ namespace NzbDrone.Web.Controllers
series.Path = seriesModel.Path; series.Path = seriesModel.Path;
series.BacklogSetting = (BacklogSettingType)seriesModel.BacklogSetting; series.BacklogSetting = (BacklogSettingType)seriesModel.BacklogSetting;
if (!String.IsNullOrWhiteSpace(seriesModel.DownloadEpisodesAiredAfter)) if (!String.IsNullOrWhiteSpace(seriesModel.CustomStartDate))
series.DownloadEpisodesAiredAfter = DateTime.Parse(seriesModel.DownloadEpisodesAiredAfter, null, DateTimeStyles.RoundtripKind); series.CustomStartDate = DateTime.Parse(seriesModel.CustomStartDate, null, DateTimeStyles.RoundtripKind);
_seriesProvider.UpdateSeries(series); _seriesProvider.UpdateSeries(series);
@ -190,8 +190,8 @@ namespace NzbDrone.Web.Controllers
SeasonFolder = s.SeasonFolder, SeasonFolder = s.SeasonFolder,
BacklogSetting = (BacklogSettingType)s.BacklogSetting, BacklogSetting = (BacklogSettingType)s.BacklogSetting,
Path = s.Path, Path = s.Path,
DownloadEpisodesAiredAfter = String.IsNullOrWhiteSpace(s.DownloadEpisodesAiredAfter) ? (DateTime?)null CustomStartDate = String.IsNullOrWhiteSpace(s.CustomStartDate) ? (DateTime?)null
: DateTime.Parse(s.DownloadEpisodesAiredAfter, null, DateTimeStyles.RoundtripKind) : DateTime.Parse(s.CustomStartDate, null, DateTimeStyles.RoundtripKind)
} }
).ToList()); ).ToList());
return JsonNotificationResult.Info("Series Mass Edit Saved"); return JsonNotificationResult.Info("Series Mass Edit Saved");
@ -220,7 +220,7 @@ namespace NzbDrone.Web.Controllers
NextAiring = s.NextAiring == null ? String.Empty : s.NextAiring.Value.ToBestDateString(), NextAiring = s.NextAiring == null ? String.Empty : s.NextAiring.Value.ToBestDateString(),
NextAiringSorter = s.NextAiring == null ? "12/31/9999" : s.NextAiring.Value.ToString("MM/dd/yyyy"), NextAiringSorter = s.NextAiring == null ? "12/31/9999" : s.NextAiring.Value.ToString("MM/dd/yyyy"),
AirTime = s.AirTimes, AirTime = s.AirTimes,
DownloadEpisodesAiredAfter = s.DownloadEpisodesAiredAfter.HasValue ? s.DownloadEpisodesAiredAfter.Value.ToString("yyyy-MM-dd") : String.Empty CustomStartDate = s.CustomStartDate.HasValue ? s.CustomStartDate.Value.ToString("yyyy-MM-dd") : String.Empty
}).ToList(); }).ToList();
return series; return series;

@ -53,8 +53,8 @@ namespace NzbDrone.Web.Models
[Description("Should NzbDrone search for missing episodes every 30 days?")] [Description("Should NzbDrone search for missing episodes every 30 days?")]
public int BacklogSetting { get; set; } public int BacklogSetting { get; set; }
[DisplayName("Download Episodes Aired After")] [DisplayName("Custom Start Date")]
[Description("Should NzbDrone only download episodes a certain date?")] [Description("Should NzbDrone only download episodes after your preferred start date?")]
public string DownloadEpisodesAiredAfter { get; set; } public string CustomStartDate { get; set; }
} }
} }

@ -25,7 +25,7 @@ $(".addExistingButton").live('click', function () {
var title = $(this).siblings(".seriesLookup").val(); var title = $(this).siblings(".seriesLookup").val();
var seriesId = $(this).siblings(".seriesId").val(); var seriesId = $(this).siblings(".seriesId").val();
var qualityId = $(this).siblings(".qualitySelector").val(); var qualityId = $(this).siblings(".qualitySelector").val();
var date = $(this).siblings('.aired-after').val(); var date = $(this).siblings('.start-date').val();
var path = root.find(".seriesPathValue Label").text(); var path = root.find(".seriesPathValue Label").text();
@ -43,7 +43,7 @@ $(".addExistingButton").live('click', function () {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: addSeriesUrl, url: addSeriesUrl,
data: jQuery.param({ path: path, seriesName: title, seriesId: seriesId, qualityProfileId: qualityId, airedAfter: date }), data: jQuery.param({ path: path, seriesName: title, seriesId: seriesId, qualityProfileId: qualityId, startDate: date }),
error: function (req, status, error) { error: function (req, status, error) {
$(button).removeAttr('disabled'); $(button).removeAttr('disabled');
alert("Sorry! We could not add " + path + " at this time. " + error); alert("Sorry! We could not add " + path + " at this time. " + error);
@ -67,10 +67,10 @@ function reloadExistingSeries() {
}); });
} }
$(".aired-after-master").live('change', function () { $(".start-date-master").live('change', function () {
var date = $(this).val(); var date = $(this).val();
$("#existingSeries").find(".aired-after").each(function () { $("#existingSeries").find(".start-date").each(function () {
$(this).val(date); $(this).val(date);
}); });
}); });
@ -129,12 +129,12 @@ $('#saveNewSeries').live('click', function () {
var seriesId = $("#newSeriesId").val(); var seriesId = $("#newSeriesId").val();
var qualityId = $("#qualityList").val(); var qualityId = $("#qualityList").val();
var path = $('#newSeriesPath').val(); var path = $('#newSeriesPath').val();
var date = $('#newAiredAfter').val(); var date = $('#newStartDate').val();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: addNewSeriesUrl, url: addNewSeriesUrl,
data: jQuery.param({ path: path, seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId, airedAfter: date }), data: jQuery.param({ path: path, seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId, startDate: date }),
error: function (req, status, error) { error: function (req, status, error) {
$('#saveNewSeries').removeAttr('disabled'); $('#saveNewSeries').removeAttr('disabled');
alert("Sorry! We could not add " + path + " at this time. " + error); alert("Sorry! We could not add " + path + " at this time. " + error);
@ -142,7 +142,7 @@ $('#saveNewSeries').live('click', function () {
success: function () { success: function () {
$('#saveNewSeries').removeAttr('disabled'); $('#saveNewSeries').removeAttr('disabled');
$("#newSeriesLookup").val(''); $("#newSeriesLookup").val('');
$('#newAiredAfter').val(''); $('#newStartDate').val('');
} }
}); });
}); });

@ -7,7 +7,7 @@
</div> </div>
@Html.DropDownList("newSeriesPath", new SelectList((IList)ViewData["RootDirs"]), new { style = "width: 406px; margin-left: 0px;" }) @Html.DropDownList("newSeriesPath", new SelectList((IList)ViewData["RootDirs"]), new { style = "width: 406px; margin-left: 0px;" })
@Html.DropDownList("qualityList", (SelectList)ViewData["QualityProfiles"], new { @class = "qualitySelector" }) @Html.DropDownList("qualityList", (SelectList)ViewData["QualityProfiles"], new { @class = "qualitySelector" })
@Html.TextBox("newAiredAfter", "", new { type = "date", @class = "jQuery-datepicker aired-after", title = "Only download episodes that aired after the choosen date" }) @Html.TextBox("newStartDate", "", new { type = "date", @class = "jQuery-datepicker start-date", placeholder = "Custom Start Date", title = "Only download episodes that aired after the specified date" })
<button id="saveNewSeries"> <button id="saveNewSeries">
Add</button> Add</button>
</div> </div>

@ -23,7 +23,7 @@ else
{ {
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" }) @Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker aired-after-master", title = "Skip episodes that aired before the choosen date" }) @Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker start-date-master", placeholder = "Custom Start Date", title = "Only download episodes that aired after the specified date" })
foreach (var series in Model.ExistingSeries) foreach (var series in Model.ExistingSeries)
{ {
@ -35,7 +35,7 @@ else
<input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" placeholder="Series Title" /> <input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" placeholder="Series Title" />
@Html.Hidden("seriesId", series.Item3, new { @class = "seriesId" }) @Html.Hidden("seriesId", series.Item3, new { @class = "seriesId" })
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" }) @Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker aired-after", title = "Only download episodes that aired after the choosen date" }) @Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker start-date", placeholder = "Custom Start Date", title = "Only download episodes that aired after the specified date" })
<button class="addExistingButton"> <button class="addExistingButton">
Add</button> Add</button>
</div> </div>

@ -20,7 +20,7 @@
position: relative; position: relative;
} }
.aired-after-master { .start-date-master {
left: 430px; left: 430px;
position: relative; position: relative;
} }
@ -51,7 +51,7 @@
text-decoration: underline; text-decoration: underline;
} }
input[type=date].aired-after { input[type=date].start-date {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>

@ -37,9 +37,9 @@
</label> </label>
@Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" }) @Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.DownloadEpisodesAiredAfter) <label class="labelClass">@Html.LabelFor(m => m.CustomStartDate)
<span class="small">@Html.DescriptionFor(m => m.DownloadEpisodesAiredAfter)</span> <span class="small">@Html.DescriptionFor(m => m.CustomStartDate)</span>
</label> </label>
@Html.TextBoxFor(m => m.DownloadEpisodesAiredAfter, new { type = "date", @class = "inputClass jQuery-datepicker" }) @Html.TextBoxFor(m => m.CustomStartDate, new { type = "date", @class = "inputClass jQuery-datepicker" })
} }
</div> </div>

@ -27,7 +27,7 @@
<th width="90px">Monitored</th> <th width="90px">Monitored</th>
<th width="110px">Season Folder</th> <th width="110px">Season Folder</th>
<th width="110px">Backlog Status</th> <th width="110px">Backlog Status</th>
<th width="80px">Aired After</th> <th width="80px" title="Custom Start Date">Start Date</th>
<th width="310px">Path</th> <th width="310px">Path</th>
</tr> </tr>
</thead> </thead>
@ -56,7 +56,7 @@
@Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "footer-control masterSelector master-backlog-setting", disabled = true }) @Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "footer-control masterSelector master-backlog-setting", disabled = true })
</th> </th>
<th> <th>
@Html.TextBox("masterAiredAfter", "" , new { type = "date", @class = "footer-control-aired-after masterSelector master-aired-after jQuery-datepicker", disabled = true }) @Html.TextBox("masterStartDate", "" , new { type = "date", @class = "footer-control-start-date masterSelector master-start-date jQuery-datepicker", disabled = true })
</th> </th>
<th> <th>
<button id="series-editor-save" type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database"> <button id="series-editor-save" type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database">
@ -184,13 +184,13 @@
}); });
}); });
$(document).on('change', '#masterAiredAfter', function () { $(document).on('change', '#masterStartDate', function () {
var airedAfter = $(this).val(); var startDate = $(this).val();
var selected = $('.editToggle:checked'); var selected = $('.editToggle:checked');
selected.each(function () { selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.aired-after').val(airedAfter); $(this).parent('td').parent('.seriesEditRow').find('.start-date').val(startDate);
}); });
}); });

@ -21,7 +21,7 @@
<td class="checkboxColumn">@Html.CheckBoxFor(m => m.Monitored, new {@class = "seriesCheckbox monitored"})</td> <td class="checkboxColumn">@Html.CheckBoxFor(m => m.Monitored, new {@class = "seriesCheckbox monitored"})</td>
<td class="checkboxColumn">@Html.CheckBoxFor(m => m.SeasonFolder, new {@class = "seriesCheckbox seasonFolder"})</td> <td class="checkboxColumn">@Html.CheckBoxFor(m => m.SeasonFolder, new {@class = "seriesCheckbox seasonFolder"})</td>
<td>@Html.DropDownListFor(m => m.BacklogSetting, new SelectList((List<KeyValuePair<int, string>>)ViewData["BacklogSettingTypes"], "Key", "Value", (int)Model.BacklogSetting), new { @class = "backlogSetting" })</td> <td>@Html.DropDownListFor(m => m.BacklogSetting, new SelectList((List<KeyValuePair<int, string>>)ViewData["BacklogSettingTypes"], "Key", "Value", (int)Model.BacklogSetting), new { @class = "backlogSetting" })</td>
<td>@Html.TextBoxFor(m => m.DownloadEpisodesAiredAfter, new { type = "date", @class = "aired-after jQuery-datepicker" })</td> <td>@Html.TextBoxFor(m => m.CustomStartDate, new { type = "date", @class = "start-date jQuery-datepicker" })</td>
<td>@Html.TextBoxFor(m => m.Path, new { @class = "path" })</td> <td>@Html.TextBoxFor(m => m.Path, new { @class = "path" })</td>
} }
</tr> </tr>
Loading…
Cancel
Save