mirror of https://github.com/Radarr/Radarr
Cleaned as much of notifications as I could find.
This commit is contained in:
parent
121f3258af
commit
3cb61e4c34
|
@ -97,6 +97,8 @@
|
|||
font-size: 20px;
|
||||
padding: 0;
|
||||
display: block;
|
||||
line-height: 1;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 1px 1px #000; /* Not supported by IE :( */
|
||||
}
|
||||
.gritter-image
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -16,7 +15,6 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
public class AddSeriesController : Controller
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
private readonly RootDirProvider _rootFolderProvider;
|
||||
|
@ -42,10 +40,10 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult ScanNewSeries()
|
||||
public EmptyResult ScanNewSeries()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(ImportNewSeriesJob));
|
||||
return new JsonResult();
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public ActionResult AddNew()
|
||||
|
@ -117,22 +115,16 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId)
|
||||
{
|
||||
if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName))
|
||||
return Json(new NotificationResult() { Title = "Failed", Text = "Invalid Series Information, Series not added.", NotificationType = NotificationType.Error });
|
||||
return JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information");
|
||||
|
||||
try
|
||||
{
|
||||
_seriesProvider.AddSeries(path, seriesId, qualityProfileId);
|
||||
ScanNewSeries();
|
||||
return Json(new NotificationResult() { Title = seriesName, Text = "Was added successfully" });
|
||||
}
|
||||
_seriesProvider.AddSeries(path, seriesId, qualityProfileId);
|
||||
ScanNewSeries();
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Json(new NotificationResult() { Title = "Failed", Text = ex.Message, NotificationType = NotificationType.Error });
|
||||
}
|
||||
return JsonNotificationResult.Info(seriesName, "Was added successfully");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -148,19 +140,6 @@ namespace NzbDrone.Web.Controllers
|
|||
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
|
||||
}
|
||||
|
||||
public JsonResult AddSeries(string path, int seriesId, int qualityProfileId)
|
||||
{
|
||||
//Get TVDB Series Name
|
||||
//Create new folder for series
|
||||
//Add the new series to the Database
|
||||
|
||||
_seriesProvider.AddSeries(
|
||||
path.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar).Replace('`', '\''), seriesId,
|
||||
qualityProfileId);
|
||||
ScanNewSeries();
|
||||
return new JsonResult { Data = "ok" };
|
||||
}
|
||||
|
||||
[ChildActionOnly]
|
||||
public ActionResult QuickAdd()
|
||||
{
|
||||
|
@ -178,19 +157,15 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
|
||||
[HttpPost]
|
||||
[JsonErrorFilter("Can't add root folder")]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult SaveRootDir(string path)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(path))
|
||||
NotificationResult.Error("Can't add root folder", "Path can not be empty");
|
||||
|
||||
//Don't let a user add a rootDir that is the same as their SABnzbd TV Directory
|
||||
if (path.Equals(_configProvider.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase))
|
||||
NotificationResult.Error("Can't add root folder", "Path can not be same as sab folder.");
|
||||
JsonNotificationResult.Error("Can't add root folder", "Path can not be empty");
|
||||
|
||||
_rootFolderProvider.Add(new RootDir { Path = path });
|
||||
|
||||
return NotificationResult.Info("Root Folder saved", "Root foler saved successfully.");
|
||||
return JsonNotificationResult.Info("Root Folder saved", "Root foler saved successfully.");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -217,20 +192,14 @@ namespace NzbDrone.Web.Controllers
|
|||
return PartialView("RootDir");
|
||||
}
|
||||
|
||||
[JsonErrorFilter]
|
||||
public JsonResult DeleteRootDir(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = _rootFolderProvider.GetAll().Where(c => c.Path == path).First().Id;
|
||||
_rootFolderProvider.Remove(id);
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
var id = _rootFolderProvider.GetAll().Where(c => c.Path == path).First().Id;
|
||||
_rootFolderProvider.Remove(id);
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using NLog;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Twitter;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Web.Filters;
|
||||
using NzbDrone.Web.Models;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
|
@ -18,8 +13,6 @@ namespace NzbDrone.Web.Controllers
|
|||
private readonly SmtpProvider _smtpProvider;
|
||||
private readonly TwitterProvider _twitterProvider;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public CommandController(JobProvider jobProvider, SabProvider sabProvider,
|
||||
SmtpProvider smtpProvider, TwitterProvider twitterProvider)
|
||||
{
|
||||
|
@ -32,54 +25,41 @@ namespace NzbDrone.Web.Controllers
|
|||
public JsonResult RssSync()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RssSyncJob));
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult BacklogSearch()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(BacklogSearchJob));
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult ScanDisk(int seriesId)
|
||||
{
|
||||
//Syncs the episodes on disk for the specified series
|
||||
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult UpdateInfo(int seriesId)
|
||||
{
|
||||
//Syncs the episodes on disk for the specified series
|
||||
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult GetSabnzbdCategories(string host, int port, string apiKey, string username, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new JsonResult {Data = _sabProvider.GetCategories(host, port, apiKey, username, password)};
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn("Unable to get Categories from SABnzbd");
|
||||
Logger.DebugException(ex.Message, ex);
|
||||
return Json(new NotificationResult { Title = "Failed", Text = "Unable to get SABnzbd Categories", NotificationType = NotificationType.Error });
|
||||
}
|
||||
return new JsonResult { Data = _sabProvider.GetCategories(host, port, apiKey, username, password) };
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SendTestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses)
|
||||
{
|
||||
if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses))
|
||||
return Json(new NotificationResult { Title = "Successfully sent test email." });
|
||||
JsonNotificationResult.Info("Successfull", "Test email sent.");
|
||||
|
||||
return Json(new NotificationResult { Title = "Failed", Text = "Unable to send Email, please check your settings", NotificationType = NotificationType.Error });
|
||||
return JsonNotificationResult.Opps("Couldn't send Email, please check your settings");
|
||||
}
|
||||
|
||||
public JsonResult GetTwitterAuthorization()
|
||||
|
@ -87,7 +67,7 @@ namespace NzbDrone.Web.Controllers
|
|||
var result = _twitterProvider.GetAuthorization();
|
||||
|
||||
if (result == null)
|
||||
return Json(new NotificationResult { Title = "Failed", Text = "Unable to get Twitter Authorization", NotificationType = NotificationType.Error }, JsonRequestBehavior.AllowGet);
|
||||
JsonNotificationResult.Opps("Couldn't get Twitter Authorization");
|
||||
|
||||
return new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
}
|
||||
|
@ -97,9 +77,10 @@ namespace NzbDrone.Web.Controllers
|
|||
var result = _twitterProvider.GetAndSaveAccessToken(token, verifier);
|
||||
|
||||
if (!result)
|
||||
return Json(new NotificationResult { Title = "Failed", Text = "Unable to verify Twitter Authorization", NotificationType = NotificationType.Error }, JsonRequestBehavior.AllowGet);
|
||||
JsonNotificationResult.Opps("Couldn't verify Twitter Authorization");
|
||||
|
||||
return JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization.");
|
||||
|
||||
return Json(new NotificationResult { Title = "Successfully verified Twitter Authorization." }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _autoCompletePath(string text, int? filterMode)
|
||||
public JsonResult _autoCompletePath(string text, int? filterMode)
|
||||
{
|
||||
var data = GetDirectories(text);
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Web.Models;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
|
@ -15,7 +10,6 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
public EpisodeController(JobProvider jobProvider)
|
||||
{
|
||||
|
||||
_jobProvider = jobProvider;
|
||||
}
|
||||
|
||||
|
@ -23,44 +17,38 @@ namespace NzbDrone.Web.Controllers
|
|||
public JsonResult Search(int episodeId)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
||||
return new JsonResult { Data = "ok" };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SearchSeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(SeasonSearchJob), seriesId, seasonNumber);
|
||||
return new JsonResult { Data = "ok" };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult BacklogSeries(int seriesId)
|
||||
{
|
||||
//Syncs the episodes on disk for the specified series
|
||||
_jobProvider.QueueJob(typeof(SeriesSearchJob), seriesId);
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult Rename(int episodeFileId)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RenameEpisodeJob), episodeFileId);
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult RenameSeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RenameSeasonJob), seriesId, seasonNumber);
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
|
||||
public JsonResult RenameEpisodes(int seriesId)
|
||||
{
|
||||
//Syncs the episodes on disk for the specified series
|
||||
_jobProvider.QueueJob(typeof(RenameSeriesJob), seriesId);
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
{
|
||||
public class HealthController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /Health/
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult Index()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Web.Models;
|
||||
using Telerik.Web.Mvc;
|
||||
|
@ -21,9 +18,6 @@ namespace NzbDrone.Web.Controllers
|
|||
_jobProvider = jobProvider;
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /History/
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
|
@ -32,13 +26,13 @@ namespace NzbDrone.Web.Controllers
|
|||
public JsonResult Trim()
|
||||
{
|
||||
_historyProvider.Trim();
|
||||
return Json(new NotificationResult() { Title = "Trimmed History items"});
|
||||
return JsonNotificationResult.Info("Trimmed History");
|
||||
}
|
||||
|
||||
public JsonResult Purge()
|
||||
{
|
||||
_historyProvider.Purge();
|
||||
return Json(new NotificationResult() { Title = "History Cleared" });
|
||||
return JsonNotificationResult.Info("History Cleared");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -47,7 +41,7 @@ namespace NzbDrone.Web.Controllers
|
|||
//Delete the existing item from history
|
||||
_historyProvider.Delete(historyId);
|
||||
|
||||
return Json(new NotificationResult() { Title = "History Item Deleted" });
|
||||
return JsonNotificationResult.Info("History Item Deleted");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -59,7 +53,7 @@ namespace NzbDrone.Web.Controllers
|
|||
//Queue a job to download the replacement episode
|
||||
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
||||
|
||||
return Json(new NotificationResult() { Title = "Episode Redownload Started" });
|
||||
return JsonNotificationResult.Info("Episode Redownload Started");
|
||||
}
|
||||
|
||||
[GridAction]
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
_logProvider.DeleteAll();
|
||||
|
||||
return Json(new NotificationResult() { Title = "Logs Cleared" });
|
||||
return JsonNotificationResult.Info("Logs Cleared");
|
||||
}
|
||||
|
||||
[GridAction]
|
||||
|
|
|
@ -112,19 +112,17 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SaveSeasonIgnore(int seriesId, int seasonNumber, bool ignored)
|
||||
public EmptyResult SaveSeasonIgnore(int seriesId, int seasonNumber, bool ignored)
|
||||
{
|
||||
_episodeProvider.SetSeasonIgnore(seriesId, seasonNumber, ignored);
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SaveEpisodeIgnore(int episodeId, bool ignored)
|
||||
public EmptyResult SaveEpisodeIgnore(int episodeId, bool ignored)
|
||||
{
|
||||
_episodeProvider.SetEpisodeIgnore(episodeId, ignored);
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public ActionResult Details(int seriesId)
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Model;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.ExternalNotification;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Web.Filters;
|
||||
using NzbDrone.Web.Models;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
|
@ -58,7 +56,7 @@ namespace NzbDrone.Web.Controllers
|
|||
results.Add(new TvDbSearchResultModel { Id = 1, Title = "30 Rock", FirstAired = DateTime.Today.ToShortDateString() });
|
||||
results.Add(new TvDbSearchResultModel { Id = 2, Title = "The Office", FirstAired = DateTime.Today.AddDays(-1).ToShortDateString() });
|
||||
|
||||
return Json(results, JsonRequestBehavior.AllowGet );
|
||||
return Json(results, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
|
@ -260,22 +258,15 @@ namespace NzbDrone.Web.Controllers
|
|||
return PartialView("QualityProfileItem", model);
|
||||
}
|
||||
|
||||
[JsonErrorFilter]
|
||||
public JsonResult DeleteQualityProfile(int profileId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
|
||||
return new JsonResult { Data = "Unable to delete Profile, it is still in use." };
|
||||
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
|
||||
return JsonNotificationResult.Opps("Profile is still in use.");
|
||||
|
||||
_qualityProvider.Delete(profileId);
|
||||
}
|
||||
_qualityProvider.Delete(profileId);
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return new JsonResult();
|
||||
}
|
||||
|
||||
public PartialViewResult AddNewznabProvider()
|
||||
|
@ -301,19 +292,11 @@ namespace NzbDrone.Web.Controllers
|
|||
return PartialView("NewznabProvider", provider);
|
||||
}
|
||||
|
||||
public JsonResult DeleteNewznabProvider(int providerId)
|
||||
[JsonErrorFilter]
|
||||
public EmptyResult DeleteNewznabProvider(int providerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
_newznabProvider.Delete(providerId);
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
_newznabProvider.Delete(providerId);
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public QualityModel GetUpdatedProfileList()
|
||||
|
@ -324,7 +307,7 @@ namespace NzbDrone.Web.Controllers
|
|||
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
|
||||
return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, QualityProfileSelectList = selectList };
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult AutoConfigureSab()
|
||||
{
|
||||
|
@ -334,19 +317,13 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
if (info != null)
|
||||
return Json(info, JsonRequestBehavior.AllowGet);
|
||||
|
||||
return Json(new NotificationResult
|
||||
{
|
||||
Title = "Auto-Configure Failed",
|
||||
Text = "Please enter your SAB Settings Manually",
|
||||
NotificationType = NotificationType.Error
|
||||
}, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
|
||||
return JsonNotificationResult.Error("Auto-Configure Failed", "Please enter your SAB Settings Manually");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -400,11 +377,6 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
//Check to see if the TV Directory matches any RootDirs (Ignoring Case), if it does, return an error to the user
|
||||
//This prevents a user from finding a way to delete their entire TV Library
|
||||
var rootDirs = _rootDirProvider.GetAll();
|
||||
if (rootDirs.Any(r => r.Path.Equals(data.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase)))
|
||||
Json(new NotificationResult { Title = "Failed", Text = "Invalid TV Directory", NotificationType = NotificationType.Error });
|
||||
|
||||
_configProvider.SabHost = data.SabHost;
|
||||
_configProvider.SabPort = data.SabPort;
|
||||
|
@ -419,8 +391,7 @@ namespace NzbDrone.Web.Controllers
|
|||
return GetSuccessResult();
|
||||
}
|
||||
|
||||
return
|
||||
Json(new NotificationResult() { Title = "Failed", Text = "Invalid request data.", NotificationType = NotificationType.Error });
|
||||
return JsonNotificationResult.Opps("Invalid Data");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -442,7 +413,7 @@ namespace NzbDrone.Web.Controllers
|
|||
profile.QualityProfileId = profileModel.QualityProfileId;
|
||||
profile.Name = profileModel.Name;
|
||||
profile.Cutoff = profileModel.Cutoff;
|
||||
|
||||
|
||||
profile.Allowed = new List<QualityTypes>();
|
||||
|
||||
if (profileModel.Sdtv)
|
||||
|
@ -506,7 +477,7 @@ namespace NzbDrone.Web.Controllers
|
|||
_configProvider.XbmcPassword = data.XbmcPassword;
|
||||
|
||||
//SMTP
|
||||
var smtpSettings = _externalNotificationProvider.GetSettings(typeof (Smtp));
|
||||
var smtpSettings = _externalNotificationProvider.GetSettings(typeof(Smtp));
|
||||
smtpSettings.Enable = data.SmtpEnabled;
|
||||
_externalNotificationProvider.SaveSettings(smtpSettings);
|
||||
|
||||
|
@ -605,18 +576,18 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
private JsonResult GetSuccessResult()
|
||||
{
|
||||
return Json(new NotificationResult() { Title = "Settings Saved" });
|
||||
return JsonNotificationResult.Info("Settings Saved");
|
||||
}
|
||||
|
||||
private JsonResult GetInvalidModelResult()
|
||||
{
|
||||
return Json(new NotificationResult() { Title = "Unable to save setting", Text = "Invalid post data", NotificationType = NotificationType.Error });
|
||||
return JsonNotificationResult.Opps("Invalid post data");
|
||||
}
|
||||
|
||||
private SelectList GetProwlPrioritySelectList()
|
||||
{
|
||||
var list = new List<ProwlPrioritySelectListModel>();
|
||||
list.Add(new ProwlPrioritySelectListModel{ Name = "Very Low", Value = -2 });
|
||||
list.Add(new ProwlPrioritySelectListModel { Name = "Very Low", Value = -2 });
|
||||
list.Add(new ProwlPrioritySelectListModel { Name = "Moderate", Value = -1 });
|
||||
list.Add(new ProwlPrioritySelectListModel { Name = "Normal", Value = 0 });
|
||||
list.Add(new ProwlPrioritySelectListModel { Name = "High", Value = 1 });
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
{
|
||||
public class StreamController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /Stream/
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return File(@"Z:\Clone High\Season 1\S01E02 - Episode Two- Election Blu-Galoo.avi", "video/divx");
|
||||
//return File(@"Z:\30 Rock\Season 5\S05E04 - Live Show (East Coast Taping) - HD TV.mkv", "video/divx");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,11 +30,12 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
public ActionResult Jobs()
|
||||
{
|
||||
ViewData["Queue"] = _jobProvider.Queue.Select(c => new JobQueueItemModel {
|
||||
Name = c.JobType.Name,
|
||||
TargetId = c.TargetId,
|
||||
SecondaryTargetId = c.SecondaryTargetId
|
||||
});
|
||||
ViewData["Queue"] = _jobProvider.Queue.Select(c => new JobQueueItemModel
|
||||
{
|
||||
Name = c.JobType.Name,
|
||||
TargetId = c.TargetId,
|
||||
SecondaryTargetId = c.SecondaryTargetId
|
||||
});
|
||||
var jobs = _jobProvider.All();
|
||||
|
||||
|
||||
|
@ -139,9 +140,9 @@ namespace NzbDrone.Web.Controllers
|
|||
public JsonResult RunJob(string typeName)
|
||||
{
|
||||
if (!_jobProvider.QueueJob(typeName))
|
||||
return Json(new NotificationResult { Title = "Failed to Start Job", Text = "Invalid job name", NotificationType = NotificationType.Error });
|
||||
return JsonNotificationResult.Opps("Invalid Job Name");
|
||||
|
||||
return Json(new NotificationResult { Title = "Job Queued" });
|
||||
return JsonNotificationResult.Info("Job Queued");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
_jobProvider.QueueJob(typeof(AppUpdateJob), 0, 0);
|
||||
|
||||
return Json(new NotificationResult { Title = "Update will begin shortly", NotificationType = NotificationType.Info, Text = "NzbDrone will restart automatically." });
|
||||
return JsonNotificationResult.Info("Update will begin shortly", "NzbDrone will restart automatically.");
|
||||
}
|
||||
|
||||
public ActionResult ViewLog( string filepath)
|
||||
|
|
|
@ -6,16 +6,9 @@ namespace NzbDrone.Web.Filters
|
|||
{
|
||||
public class JsonErrorFilter : FilterAttribute, IExceptionFilter
|
||||
{
|
||||
private readonly string _errorTitle;
|
||||
|
||||
public JsonErrorFilter(string errorTitle)
|
||||
{
|
||||
_errorTitle = errorTitle;
|
||||
}
|
||||
|
||||
public void OnException(ExceptionContext filterContext)
|
||||
{
|
||||
filterContext.Result = NotificationResult.Error(_errorTitle, filterContext.Exception.Message);
|
||||
filterContext.Result = JsonNotificationResult.Opps(filterContext.Exception.Message);
|
||||
filterContext.ExceptionHandled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ using System.Web.Mvc;
|
|||
|
||||
namespace NzbDrone.Web.Models
|
||||
{
|
||||
public class NotificationResult
|
||||
public class JsonNotificationResult
|
||||
{
|
||||
public NotificationResult()
|
||||
private JsonNotificationResult()
|
||||
{
|
||||
Text = string.Empty;
|
||||
}
|
||||
|
@ -16,7 +16,12 @@ namespace NzbDrone.Web.Models
|
|||
|
||||
public static JsonResult Info(string title, string text)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Error, title, text);
|
||||
return GetJsonResult(NotificationType.Info, title, text);
|
||||
}
|
||||
|
||||
public static JsonResult Info(string title)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Info, title, string.Empty);
|
||||
}
|
||||
|
||||
public static JsonResult Error(string title, string text)
|
||||
|
@ -24,11 +29,17 @@ namespace NzbDrone.Web.Models
|
|||
return GetJsonResult(NotificationType.Error, title, text);
|
||||
}
|
||||
|
||||
public static JsonResult Opps(string text)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Error, "Opps!", text);
|
||||
}
|
||||
|
||||
|
||||
public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
|
||||
{
|
||||
return new JsonResult
|
||||
{
|
||||
Data = new NotificationResult { NotificationType = notificationType, Title = title, Text = text },
|
||||
Data = new JsonNotificationResult { NotificationType = notificationType, Title = title, Text = text },
|
||||
ContentType = null,
|
||||
ContentEncoding = null,
|
||||
JsonRequestBehavior = JsonRequestBehavior.AllowGet
|
|
@ -213,7 +213,6 @@
|
|||
<Compile Include="Controllers\SeriesController.cs" />
|
||||
<Compile Include="Controllers\SettingsController.cs" />
|
||||
<Compile Include="Controllers\SharedController.cs" />
|
||||
<Compile Include="Controllers\StreamController.cs" />
|
||||
<Compile Include="Controllers\SystemController.cs" />
|
||||
<Compile Include="Controllers\UpcomingController.cs" />
|
||||
<Compile Include="Controllers\UpdateController.cs" />
|
||||
|
@ -232,7 +231,7 @@
|
|||
<Compile Include="Models\FooterModel.cs" />
|
||||
<Compile Include="Models\ExistingSeriesModel.cs" />
|
||||
<Compile Include="Models\JobQueueItemModel.cs" />
|
||||
<Compile Include="Models\NotificationResult.cs" />
|
||||
<Compile Include="Models\JsonNotificationResult.cs" />
|
||||
<Compile Include="Models\PendingProcessingModel.cs" />
|
||||
<Compile Include="Models\ProwlPrioritySelectListModel.cs" />
|
||||
<Compile Include="Models\SabnzbdSettingsModel.cs" />
|
||||
|
|
Loading…
Reference in New Issue