EpisodeAiredAfter added to AddSeries UI

New: Ability to skip episodes that aired before a certain date, per
series.
pull/19/head
Mark McDowall 12 years ago
parent 713c4225c0
commit 6c78187601

@ -729,7 +729,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//act
var seriesProvider = Mocker.Resolve<SeriesProvider>();
seriesProvider.AddSeries("Test Series","c:\\test\\", tvDbSeriesId, 1);
seriesProvider.AddSeries("Test Series","c:\\test\\", tvDbSeriesId, 1, null);
var episodeProvider = Mocker.Resolve<EpisodeProvider>();
episodeProvider.RefreshEpisodeInfo(seriesProvider.GetSeries(tvDbSeriesId));

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//Act
var seriesProvider = Mocker.Resolve<SeriesProvider>();
seriesProvider.AddSeries(title, path, tvDbId, qualityProfileId);
seriesProvider.AddSeries(title, path, tvDbId, qualityProfileId, null);
//Assert
var series = seriesProvider.GetAllSeries();
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void add_series_should_fail_if_series_is_less_than_zero(int seriesId)
{
WithRealDb();
Assert.Throws<ArgumentOutOfRangeException>(() => Mocker.Resolve<SeriesProvider>().AddSeries("Title", "C:\\Test", seriesId, 1));
Assert.Throws<ArgumentOutOfRangeException>(() => Mocker.Resolve<SeriesProvider>().AddSeries("Title", "C:\\Test", seriesId, 1, null));
}
[Test]

@ -110,7 +110,7 @@ namespace NzbDrone.Core.Providers
return series;
}
public virtual void AddSeries(string title, string path, int tvDbSeriesId, int qualityProfileId)
public virtual void AddSeries(string title, string path, int tvDbSeriesId, int qualityProfileId, DateTime? airedAfter)
{
Logger.Info("Adding Series [{0}] Path: [{1}]", tvDbSeriesId, path);
@ -131,6 +131,9 @@ namespace NzbDrone.Core.Providers
repoSeries.SeasonFolder = _configProvider.UseSeasonFolder;
repoSeries.BacklogSetting = BacklogSettingType.Inherit;
if (airedAfter.HasValue)
repoSeries.DownloadEpisodesAiredAfter = airedAfter;
_database.Insert(repoSeries);
}

@ -115,7 +115,7 @@ hr
}
input[type=text], select
input[type=text], input[type=date], select
{
font-size: small;
padding: 2px 2px;

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Mvc;
@ -116,7 +117,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId)
public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId, string airedAfter)
{
if (string.IsNullOrWhiteSpace(path) || String.Equals(path,"null",StringComparison.InvariantCultureIgnoreCase))
return JsonNotificationResult.Error("Couldn't add " + seriesName, "You need a valid root folder");
@ -127,17 +128,22 @@ namespace NzbDrone.Web.Controllers
//Use the created folder name when adding the series
path = _diskProvider.CreateDirectory(path);
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId, airedAfter);
}
[HttpPost]
[JsonErrorFilter]
public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId)
public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId, string airedAfter)
{
if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName))
return JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information");
_seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId);
DateTime? date = null;
if (!String.IsNullOrWhiteSpace(airedAfter))
date = DateTime.Parse(airedAfter, null, DateTimeStyles.RoundtripKind);
_seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId, date);
ScanNewSeries();
return JsonNotificationResult.Info(seriesName, "Was added successfully");
@ -153,7 +159,7 @@ namespace NzbDrone.Web.Controllers
//Use the created folder name when adding the series
path = _diskProvider.CreateDirectory(path);
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId, null);
}
[ChildActionOnly]

@ -44,4 +44,10 @@
}
});
});
$('.jQuery-dateTime').livequery(function () {
$(this).datepicker({
dateFormat: "yy-mm-dd"
});
});
});

@ -24,6 +24,7 @@ $(".addExistingButton").live('click', function() {
var title = $(this).siblings(".seriesLookup").val();
var seriesId = $(this).siblings(".seriesId").val();
var qualityId = $(this).siblings(".qualitySelector").val();
var date = $(this).siblings('.aired-after').val();
var path = root.find(".seriesPathValue Label").text();
@ -41,7 +42,7 @@ $(".addExistingButton").live('click', function() {
$.ajax({
type: "POST",
url: addSeriesUrl,
data: jQuery.param({ path: path, seriesName: title, seriesId: seriesId, qualityProfileId: qualityId }),
data: jQuery.param({ path: path, seriesName: title, seriesId: seriesId, qualityProfileId: qualityId, airedAfter: date }),
error: function(req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error);
},
@ -64,6 +65,14 @@ function reloadExistingSeries() {
});
}
$(".aired-after-master").live('change', function () {
var date = $(this).val();
$("#existingSeries").find(".aired-after").each(function () {
$(this).val(date);
});
});
//RootDir
//Delete RootDir
$('#rootDirs .actionButton img').live('click', function (image) {
@ -116,11 +125,12 @@ $('#saveNewSeries').live('click', function () {
var seriesId = $("#newSeriesId").val();
var qualityId = $("#qualityList").val();
var path = $('#newSeriesPath').val();
var date = $('#newAiredAfter').val();
$.ajax({
type: "POST",
url: addNewSeriesUrl,
data: jQuery.param({ path: path, seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId }),
data: jQuery.param({ path: path, seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId, airedAfter: date }),
error: function (req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error);
},

@ -7,6 +7,7 @@
</div>
@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.TextBox("newAiredAfter", "", new { type = "date", @class = "jQuery-dateTime aired-after", title = "Only download episodes that aired after the choosen date" })
<button id="saveNewSeries">
Add</button>
</div>

@ -23,6 +23,8 @@ else
{
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-dateTime aired-after-master", title = "Skip episodes that aired before the choosen date" })
foreach (var series in Model.ExistingSeries)
{
<div class="existingSeries">
@ -30,9 +32,10 @@ else
<label>@series.Item1</label>
</span>
<div class="existingSeriesContainer">
<input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" />
<input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" placeholder="Series Title" />
@Html.Hidden("seriesId", series.Item3, new { @class = "seriesId" })
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-dateTime aired-after", title = "Only download episodes that aired after the choosen date" })
<button class="addExistingButton">
Add</button>
</div>

@ -19,6 +19,11 @@
left: 415px;
position: relative;
}
.aired-after-master {
left: 430px;
position: relative;
}
.seriesPathValue
{
@ -45,6 +50,10 @@
cursor: pointer;
text-decoration: underline;
}
input[type=date].aired-after {
margin-left: 10px;
}
</style>
}

Loading…
Cancel
Save