|
|
@ -9,6 +9,7 @@ using NzbDrone.Core.Jobs;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
using NzbDrone.Web.Filters;
|
|
|
|
using NzbDrone.Web.Models;
|
|
|
|
using NzbDrone.Web.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
@ -176,31 +177,20 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Root Directory
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[JsonErrorFilter("Can't add root folder")]
|
|
|
|
public JsonResult SaveRootDir(string path)
|
|
|
|
public JsonResult SaveRootDir(string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (String.IsNullOrWhiteSpace(path))
|
|
|
|
if (String.IsNullOrWhiteSpace(path))
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
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
|
|
|
|
//Don't let a user add a rootDir that is the same as their SABnzbd TV Directory
|
|
|
|
if (path.Equals(_configProvider.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
if (path.Equals(_configProvider.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
NotificationResult.Error("Can't add root folder", "Path can not be same as sab folder.");
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_rootFolderProvider.Add(new RootDir { Path = path });
|
|
|
|
_rootFolderProvider.Add(new RootDir { Path = path });
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return NotificationResult.Info("Root Folder saved", "Root foler saved successfully.");
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger.Debug("Failed to save Root Dir");
|
|
|
|
|
|
|
|
Logger.DebugException(ex.Message, ex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|