From a3e5c9031998742b0dd8b8637ddb084ec3b8bafe Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 18 Oct 2011 16:49:43 -0700 Subject: [PATCH 1/7] Cleanup generating paths for error scenarios. --- NzbDrone.Core/Providers/PostDownloadProvider.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Core/Providers/PostDownloadProvider.cs b/NzbDrone.Core/Providers/PostDownloadProvider.cs index e6050b7eb..b80771930 100644 --- a/NzbDrone.Core/Providers/PostDownloadProvider.cs +++ b/NzbDrone.Core/Providers/PostDownloadProvider.cs @@ -114,8 +114,7 @@ namespace NzbDrone.Core.Providers //Rename the Directory so it's not processed again. _diskProvider.MoveDirectory(subfolderInfo.FullName, - Path.Combine(subfolderInfo.Parent.FullName, - "_NzbDrone_InvalidSeries_" + subfolderInfo.Name)); + GetNewFolderNameWithPostDownloadStatus(subfolderInfo, PostDownloadStatusType.InvalidSeries)); return; } @@ -132,9 +131,8 @@ namespace NzbDrone.Core.Providers if (importedFiles.Count == 0) { Logger.Warn("Unable to Import new download [{0}], unable to parse episode file(s).", subfolderInfo.FullName); - _diskProvider.MoveDirectory(subfolderInfo.FullName, - Path.Combine(subfolderInfo.Parent.FullName, - "_NzbDrone_ParseError_" + subfolderInfo.Name)); + _diskProvider.MoveDirectory(subfolderInfo.FullName, + GetNewFolderNameWithPostDownloadStatus(subfolderInfo, PostDownloadStatusType.ParseError)); } //Unknown Error Importing (Possibly a lesser quality than episode currently on disk) @@ -142,9 +140,7 @@ namespace NzbDrone.Core.Providers { Logger.Warn("Unable to Import new download [{0}].", subfolderInfo.FullName); - _diskProvider.MoveDirectory(subfolderInfo.FullName, - Path.Combine(subfolderInfo.Parent.FullName, - "_NzbDrone_" + subfolderInfo.Name)); + _diskProvider.MoveDirectory(subfolderInfo.FullName, GetNewFolderNameWithPostDownloadStatus(subfolderInfo, PostDownloadStatusType.Unknown)); } } } From d62345f6d74fd91be82e6de1a8eecdd28a6743a1 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 19 Oct 2011 08:10:36 -0700 Subject: [PATCH 2/7] Javascript and CSS references in _Layout use relative paths instead of absolute. --- NzbDrone.Web/Views/Shared/_Layout.cshtml | 43 ++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index 673827d6b..39dfbda6c 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -5,28 +5,29 @@ NZBDrone - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + @MvcMiniProfiler.MiniProfiler.RenderIncludes() @RenderSection("HeaderContent", required: false) From a9bcbfad8c878b6fd6382a8c9da5aa414608f0eb Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 19 Oct 2011 08:16:34 -0700 Subject: [PATCH 3/7] Added QuickAdd for adding series, not displayed currently, needs some prettifying. --- NzbDrone.Web/Content/NzbDrone.css | 7 ++++ .../Controllers/AddSeriesController.cs | 32 +++++++++++++++++-- NzbDrone.Web/NzbDrone.Web.csproj | 3 ++ NzbDrone.Web/Scripts/addSeries.js | 21 ++++++++++++ NzbDrone.Web/Views/AddSeries/AddNew.cshtml | 2 +- NzbDrone.Web/Views/AddSeries/Index.cshtml | 4 --- NzbDrone.Web/Views/Shared/QuickAdd.cshtml | 15 +++++++++ SharedLiveTemplates.xml | 1 + 8 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 NzbDrone.Web/Views/Shared/QuickAdd.cshtml create mode 100644 SharedLiveTemplates.xml diff --git a/NzbDrone.Web/Content/NzbDrone.css b/NzbDrone.Web/Content/NzbDrone.css index 58d512762..5b452186e 100644 --- a/NzbDrone.Web/Content/NzbDrone.css +++ b/NzbDrone.Web/Content/NzbDrone.css @@ -235,4 +235,11 @@ select, button, input[type="button"], input[type="submit"], input[type="reset"] { min-width: 60px; width: auto; +} + +#quickAdd +{ + position: fixed; + top: 30px; + right: 15px; } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 429de70f7..0487b540f 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -53,9 +53,7 @@ namespace NzbDrone.Web.Controllers var defaultQuality = _configProvider.DefaultQualityProfile; var qualityProfiles = _qualityProvider.All(); - ViewData["qualityList"] = qualityProfiles; - - ViewData["quality"] = new SelectList( + ViewData["qualityProfiles"] = new SelectList( qualityProfiles, "QualityProfileId", "Name", @@ -132,6 +130,19 @@ namespace NzbDrone.Web.Controllers } } + [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); + } + public JsonResult AddSeries(string path, int seriesId, int qualityProfileId) { //Get TVDB Series Name @@ -145,6 +156,21 @@ namespace NzbDrone.Web.Controllers return new JsonResult { Data = "ok" }; } + [ChildActionOnly] + public ActionResult QuickAdd() + { + var defaultQuality = _configProvider.DefaultQualityProfile; + var qualityProfiles = _qualityProvider.All(); + + ViewData["qualityProfiles"] = new SelectList( + qualityProfiles, + "QualityProfileId", + "Name", + defaultQuality); + + return PartialView(); + } + //Root Directory [HttpPost] diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 1068453a3..89204688f 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -929,6 +929,9 @@ + + + \ No newline at end of file + +
+
+ Local Series Search + +
+
+
+ Search
+
+
+
diff --git a/NzbDrone.Web/Views/Shared/LocalSearch.cshtml b/NzbDrone.Web/Views/Shared/LocalSearch.cshtml new file mode 100644 index 000000000..b06f5700e --- /dev/null +++ b/NzbDrone.Web/Views/Shared/LocalSearch.cshtml @@ -0,0 +1,29 @@ +@{ + Layout = null; +} + + + +
+
+ Local Series Search + +
+
+
+ Search
+
+
+
\ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index c8771a6ae..029e1a298 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -15,6 +15,7 @@ + @@ -28,12 +29,14 @@ + @MvcMiniProfiler.MiniProfiler.RenderIncludes() @RenderSection("HeaderContent", required: false)
+ @{Html.RenderAction("LocalSearch", "Shared");}