SeriesId is now passed back to the controller when adding a new/existing series.
This commit is contained in:
parent
d330c65165
commit
7786f6a914
|
@ -69,7 +69,6 @@ namespace NzbDrone.Web.Controllers
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ActionResult ExistingSeries()
|
public ActionResult ExistingSeries()
|
||||||
{
|
{
|
||||||
var result = new ExistingSeriesModel();
|
var result = new ExistingSeriesModel();
|
||||||
|
@ -81,7 +80,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path));
|
unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
result.ExistingSeries = new List<Tuple<string, string>>();
|
result.ExistingSeries = new List<Tuple<string, string, int>>();
|
||||||
|
|
||||||
foreach (var folder in unmappedList)
|
foreach (var folder in unmappedList)
|
||||||
{
|
{
|
||||||
|
@ -89,12 +88,14 @@ namespace NzbDrone.Web.Controllers
|
||||||
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
var tvdbResult = _tvDbProvider.SearchSeries(foldername).FirstOrDefault();
|
||||||
|
|
||||||
var title = String.Empty;
|
var title = String.Empty;
|
||||||
|
var seriesId = 0;
|
||||||
if (tvdbResult != null)
|
if (tvdbResult != null)
|
||||||
{
|
{
|
||||||
title = tvdbResult.SeriesName;
|
title = tvdbResult.SeriesName;
|
||||||
|
seriesId = tvdbResult.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.ExistingSeries.Add(new Tuple<string, string>(folder, title));
|
result.ExistingSeries.Add(new Tuple<string, string, int>(folder, title, seriesId));
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||||
|
@ -104,23 +105,21 @@ namespace NzbDrone.Web.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public JsonResult AddNewSeries(string path, string seriesName, int qualityProfileId)
|
public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId)
|
||||||
{
|
{
|
||||||
path = Path.Combine(path, MediaFileProvider.CleanFilename(seriesName));
|
path = Path.Combine(path, MediaFileProvider.CleanFilename(seriesName));
|
||||||
return AddExistingSeries(path, seriesName, qualityProfileId);
|
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public JsonResult AddExistingSeries(string path, string seriesName, int qualityProfileId)
|
public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Create the folder for the new series and then Add it
|
//Create the folder for the new series and then Add it
|
||||||
_diskProvider.CreateDirectory(path);
|
_diskProvider.CreateDirectory(path);
|
||||||
|
|
||||||
var series = _tvDbProvider.SearchSeries(seriesName).Where(s => s.SeriesName == seriesName).Single();
|
_seriesProvider.AddSeries(path, seriesId, qualityProfileId);
|
||||||
|
|
||||||
_seriesProvider.AddSeries(path, series.Id, qualityProfileId);
|
|
||||||
ScanNewSeries();
|
ScanNewSeries();
|
||||||
return Json(new NotificationResult() { Title = seriesName, Text = "Was added successfully" });
|
return Json(new NotificationResult() { Title = seriesName, Text = "Was added successfully" });
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@ namespace NzbDrone.Web.Models
|
||||||
{
|
{
|
||||||
public SelectList Quality { get; set; }
|
public SelectList Quality { get; set; }
|
||||||
|
|
||||||
public List<Tuple<string, string>> ExistingSeries { get; set; }
|
public List<Tuple<string, string, int>> ExistingSeries { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -683,9 +683,7 @@
|
||||||
<Content Include="Scripts\Plugins\MicrosoftAjax.js" />
|
<Content Include="Scripts\Plugins\MicrosoftAjax.js" />
|
||||||
<Content Include="Scripts\Plugins\MicrosoftMvcAjax.debug.js" />
|
<Content Include="Scripts\Plugins\MicrosoftMvcAjax.debug.js" />
|
||||||
<Content Include="Scripts\Plugins\MicrosoftMvcAjax.js" />
|
<Content Include="Scripts\Plugins\MicrosoftMvcAjax.js" />
|
||||||
<Content Include="Scripts\Plugins\yui-min.js" />
|
|
||||||
<Content Include="Scripts\seriesDetails.js" />
|
<Content Include="Scripts\seriesDetails.js" />
|
||||||
<Content Include="Scripts\Plugins\jquery.livequery.js" />
|
|
||||||
<Content Include="Scripts\settingsForm.js" />
|
<Content Include="Scripts\settingsForm.js" />
|
||||||
<Content Include="Scripts\Plugins\doTimeout.js" />
|
<Content Include="Scripts\Plugins\doTimeout.js" />
|
||||||
<Content Include="Scripts\episodeSearch.js" />
|
<Content Include="Scripts\episodeSearch.js" />
|
||||||
|
|
|
@ -40,6 +40,7 @@ function bindSeriesAutoComplete(selector) {
|
||||||
delay: 500,
|
delay: 500,
|
||||||
select: function (event, ui) {
|
select: function (event, ui) {
|
||||||
$(this).val(ui.item.Title);
|
$(this).val(ui.item.Title);
|
||||||
|
$(this).siblings('.seriesId').val(ui.item.Id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -23,6 +23,7 @@ $(".addExistingButton").live('click', function () {
|
||||||
var root = $(this).parents(".existingSeries");
|
var root = $(this).parents(".existingSeries");
|
||||||
|
|
||||||
var title = $(this).siblings(".seriesLookup").val();
|
var title = $(this).siblings(".seriesLookup").val();
|
||||||
|
var seriesId = $(this).siblings(".seriesId").val();
|
||||||
var qualityId = $(this).siblings(".qualitySelector").val();
|
var qualityId = $(this).siblings(".qualitySelector").val();
|
||||||
|
|
||||||
var path = root.find(".seriesPathValue Label").text();
|
var path = root.find(".seriesPathValue Label").text();
|
||||||
|
@ -30,7 +31,7 @@ $(".addExistingButton").live('click', function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: addSeriesUrl,
|
url: addSeriesUrl,
|
||||||
data: jQuery.param({ path: path, seriesName: title, qualityProfileId: qualityId }),
|
data: jQuery.param({ path: path, seriesName: title, seriesId: seriesId, qualityProfileId: qualityId }),
|
||||||
error: function (req, status, error) {
|
error: function (req, status, error) {
|
||||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||||
},
|
},
|
||||||
|
@ -79,13 +80,14 @@ function refreshRoot() {
|
||||||
//AddNew
|
//AddNew
|
||||||
$('#saveNewSeries').live('click', function () {
|
$('#saveNewSeries').live('click', function () {
|
||||||
var seriesTitle = $("#newSeriesLookup").val();
|
var seriesTitle = $("#newSeriesLookup").val();
|
||||||
|
var seriesId = $("#newSeriesId").val();
|
||||||
var qualityId = $("#qualityList").val();
|
var qualityId = $("#qualityList").val();
|
||||||
var path = $('#newSeriesPath').val();
|
var path = $('#newSeriesPath').val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: addNewSeriesUrl,
|
url: addNewSeriesUrl,
|
||||||
data: jQuery.param({ path: path, seriesName: seriesTitle, qualityProfileId: qualityId }),
|
data: jQuery.param({ path: path, seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId }),
|
||||||
error: function (req, status, error) {
|
error: function (req, status, error) {
|
||||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<input id="newSeriesLookup" class="seriesLookup" type="text" style="width: 400px" />
|
<input id="newSeriesLookup" class="seriesLookup" type="text" style="width: 400px" />
|
||||||
|
@Html.Hidden("newSeriesId", 0, new { @class = "seriesId" })
|
||||||
</div>
|
</div>
|
||||||
@*<input id="newSeriesPath" class="folderLookup" type="text" style="width: 400px" />*@
|
|
||||||
@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", new SelectList((IList)ViewData["QualityList"], "QualityProfileId", "Name"), new { @class = "qualitySelector" })
|
@Html.DropDownList("qualityList", new SelectList((IList)ViewData["QualityList"], "QualityProfileId", "Name"), new { @class = "qualitySelector" })
|
||||||
<button id="saveNewSeries">
|
<button id="saveNewSeries">
|
||||||
|
|
|
@ -52,6 +52,7 @@ else
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input class="seriesLookup" type="text" style="width: 400px" value="@series.Item2" />
|
<input class="seriesLookup" type="text" style="width: 400px" value="@series.Item2" />
|
||||||
|
@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" })
|
||||||
<button class="addExistingButton">
|
<button class="addExistingButton">
|
||||||
Add</button>
|
Add</button>
|
||||||
|
|
Loading…
Reference in New Issue