mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Merge remote-tracking branch 'origin/master' into dynamic-jobs
Conflicts: NzbDrone.Web/Scripts/NzbDrone/series.js
This commit is contained in:
commit
b21bf01bf0
40 changed files with 700 additions and 262 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
@ -43,11 +44,9 @@ namespace NzbDrone.Web.Controllers
|
|||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public EmptyResult ScanNewSeries()
|
||||
public ActionResult Index()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(ImportNewSeriesJob));
|
||||
return new EmptyResult();
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult AddNew()
|
||||
|
@ -66,11 +65,6 @@ namespace NzbDrone.Web.Controllers
|
|||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult ExistingSeries()
|
||||
{
|
||||
var result = new ExistingSeriesModel();
|
||||
|
@ -116,7 +110,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 startDate)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || String.Equals(path,"null",StringComparison.InvariantCultureIgnoreCase))
|
||||
return JsonNotificationResult.Error("Couldn't add " + seriesName, "You need a valid root folder");
|
||||
|
@ -127,63 +121,27 @@ 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, startDate);
|
||||
}
|
||||
|
||||
[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 startDate)
|
||||
{
|
||||
if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName))
|
||||
return JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information");
|
||||
|
||||
_seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId);
|
||||
ScanNewSeries();
|
||||
DateTime? date = null;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(startDate))
|
||||
date = DateTime.Parse(startDate, null, DateTimeStyles.RoundtripKind);
|
||||
|
||||
_seriesProvider.AddSeries(seriesName,path, seriesId, qualityProfileId, date);
|
||||
_jobProvider.QueueJob(typeof(ImportNewSeriesJob));
|
||||
|
||||
return JsonNotificationResult.Info(seriesName, "Was added successfully");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult QuickAddNewSeries(string seriesName, int seriesId, int qualityProfileId)
|
||||
{
|
||||
var path = _rootFolderProvider.GetMostFreeRootDir();
|
||||
path = Path.Combine(path, MediaFileProvider.CleanFilename(seriesName));
|
||||
|
||||
//Create the folder for the new series
|
||||
//Use the created folder name when adding the series
|
||||
path = _diskProvider.CreateDirectory(path);
|
||||
|
||||
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
|
||||
}
|
||||
|
||||
[ChildActionOnly]
|
||||
public ActionResult QuickAdd()
|
||||
{
|
||||
var defaultQuality = _configProvider.DefaultQualityProfile;
|
||||
var qualityProfiles = _qualityProvider.All();
|
||||
|
||||
ViewData["qualityProfiles"] = new SelectList(
|
||||
qualityProfiles,
|
||||
"QualityProfileId",
|
||||
"Name",
|
||||
defaultQuality);
|
||||
|
||||
return PartialView();
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult SaveRootDir(string path)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(path))
|
||||
JsonNotificationResult.Error("Can't add root folder", "Path can not be empty");
|
||||
|
||||
_rootFolderProvider.Add(new RootDir { Path = path });
|
||||
|
||||
return JsonNotificationResult.Info("Root Folder saved", "Root folder saved successfully.");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult LookupSeries(string term)
|
||||
{
|
||||
|
@ -228,6 +186,18 @@ namespace NzbDrone.Web.Controllers
|
|||
return PartialView("RootDir");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult SaveRootDir(string path)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(path))
|
||||
JsonNotificationResult.Error("Can't add root folder", "Path can not be empty");
|
||||
|
||||
_rootFolderProvider.Add(new RootDir { Path = path });
|
||||
|
||||
return JsonNotificationResult.Info("Root Folder saved", "Root folder saved successfully.");
|
||||
}
|
||||
|
||||
[JsonErrorFilter]
|
||||
public JsonResult DeleteRootDir(string path)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
@ -44,7 +45,7 @@ namespace NzbDrone.Web.Controllers
|
|||
return View((object)serialized);
|
||||
}
|
||||
|
||||
public ActionResult SingleSeriesEditor(int seriesId)
|
||||
public ActionResult Edit(int seriesId)
|
||||
{
|
||||
var profiles = _qualityProvider.All();
|
||||
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
|
@ -63,7 +64,7 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public EmptyResult SaveSingleSeriesEditor(SeriesModel seriesModel)
|
||||
public EmptyResult Edit(SeriesModel seriesModel)
|
||||
{
|
||||
var series = _seriesProvider.GetSeries(seriesModel.SeriesId);
|
||||
series.Monitored = seriesModel.Monitored;
|
||||
|
@ -72,6 +73,9 @@ namespace NzbDrone.Web.Controllers
|
|||
series.Path = seriesModel.Path;
|
||||
series.BacklogSetting = (BacklogSettingType)seriesModel.BacklogSetting;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(seriesModel.CustomStartDate))
|
||||
series.CustomStartDate = DateTime.Parse(seriesModel.CustomStartDate, null, DateTimeStyles.RoundtripKind);
|
||||
|
||||
_seriesProvider.UpdateSeries(series);
|
||||
|
||||
return new EmptyResult();
|
||||
|
@ -166,19 +170,30 @@ namespace NzbDrone.Web.Controllers
|
|||
masterBacklogList.Insert(0, new KeyValuePair<int, string>(-10, "Select..."));
|
||||
ViewData["MasterBacklogSettingSelectList"] = new SelectList(masterBacklogList, "Key", "Value");
|
||||
|
||||
var series = _seriesProvider.GetAllSeries().OrderBy(o => SortHelper.SkipArticles(o.Title));
|
||||
var series = GetSeriesModels(_seriesProvider.GetAllSeries()).OrderBy(o => SortHelper.SkipArticles(o.Title));
|
||||
|
||||
return View(series);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SaveEditor(List<Series> series)
|
||||
public JsonResult Editor(List<SeriesModel> series)
|
||||
{
|
||||
//Save edits
|
||||
if (series == null || series.Count == 0)
|
||||
return JsonNotificationResult.Oops("Invalid post data");
|
||||
|
||||
_seriesProvider.UpdateFromSeriesEditor(series);
|
||||
_seriesProvider.UpdateFromSeriesEditor(series.Select(s => new Series
|
||||
{
|
||||
SeriesId = s.SeriesId,
|
||||
QualityProfileId = s.QualityProfileId,
|
||||
Monitored = s.Monitored,
|
||||
SeasonFolder = s.SeasonFolder,
|
||||
BacklogSetting = (BacklogSettingType)s.BacklogSetting,
|
||||
Path = s.Path,
|
||||
CustomStartDate = String.IsNullOrWhiteSpace(s.CustomStartDate) ? (DateTime?)null
|
||||
: DateTime.Parse(s.CustomStartDate, null, DateTimeStyles.RoundtripKind)
|
||||
}
|
||||
).ToList());
|
||||
return JsonNotificationResult.Info("Series Mass Edit Saved");
|
||||
}
|
||||
|
||||
|
@ -204,7 +219,8 @@ namespace NzbDrone.Web.Controllers
|
|||
EpisodeFileCount = s.EpisodeFileCount,
|
||||
NextAiring = s.NextAiring == null ? String.Empty : s.NextAiring.Value.ToBestDateString(),
|
||||
NextAiringSorter = s.NextAiring == null ? "12/31/9999" : s.NextAiring.Value.ToString("MM/dd/yyyy"),
|
||||
AirTime = s.AirTimes
|
||||
AirTime = s.AirTimes,
|
||||
CustomStartDate = s.CustomStartDate.HasValue ? s.CustomStartDate.Value.ToString("yyyy-MM-dd") : String.Empty
|
||||
}).ToList();
|
||||
|
||||
return series;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue