mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Post Processor Done.
Will send from SAB to NzbDrone. Changed SabCategory to SabTvCategory (Support for movies later?)
This commit is contained in:
parent
e166cb1b2d
commit
70fd11231d
9 changed files with 124 additions and 26 deletions
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
|
@ -12,16 +13,31 @@ namespace NzbDrone.Web.Controllers
|
|||
public class ApiController : Controller
|
||||
{
|
||||
private readonly IPostProcessingProvider _postProcessingProvider;
|
||||
private readonly IConfigProvider _configProvider;
|
||||
|
||||
public ApiController(IPostProcessingProvider postProcessingProvider)
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public ApiController(IPostProcessingProvider postProcessingProvider, IConfigProvider configProvider)
|
||||
{
|
||||
_postProcessingProvider = postProcessingProvider;
|
||||
_configProvider = configProvider;
|
||||
}
|
||||
|
||||
public ActionResult ProcessEpisode(string dir, string nzbName)
|
||||
public ActionResult ProcessEpisode(string apiKey, string dir, string nzbName, string category)
|
||||
{
|
||||
_postProcessingProvider.ProcessEpisode(dir, nzbName);
|
||||
return Content("ok");
|
||||
if (apiKey != _configProvider.GetValue("ApiKey", String.Empty, true))
|
||||
{
|
||||
Logger.Warn("API Key from Post Processing Script is Invalid");
|
||||
return Content("Invalid API Key");
|
||||
}
|
||||
|
||||
if (_configProvider.GetValue("SabTvCategory", String.Empty, true) == category)
|
||||
{
|
||||
_postProcessingProvider.ProcessEpisode(dir, nzbName);
|
||||
return Content("ok");
|
||||
}
|
||||
|
||||
return Content("Category doesn't match what was configured for SAB TV Category...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ namespace NzbDrone.Web.Controllers
|
|||
ViewData["viewName"] = "Indexers";
|
||||
return View("Index", new IndexerSettingsModel
|
||||
{
|
||||
NzbMatrixUsername = _configProvider.GetValue("NzbMatrixUsername", String.Empty, false),
|
||||
NzbMatrixApiKey = _configProvider.GetValue("NzbMatrixApiKey", String.Empty, false),
|
||||
NzbsOrgUId = _configProvider.GetValue("NzbsOrgUId", String.Empty, false),
|
||||
NzbsOrgHash = _configProvider.GetValue("NzbsOrgHash", String.Empty, false),
|
||||
NzbsrusUId = _configProvider.GetValue("NzbsrusUId", String.Empty, false),
|
||||
NzbsrusHash = _configProvider.GetValue("NzbsrusHash", String.Empty, false),
|
||||
NzbMatrixUsername = _configProvider.GetValue("NzbMatrixUsername", String.Empty, true),
|
||||
NzbMatrixApiKey = _configProvider.GetValue("NzbMatrixApiKey", String.Empty, true),
|
||||
NzbsOrgUId = _configProvider.GetValue("NzbsOrgUId", String.Empty, true),
|
||||
NzbsOrgHash = _configProvider.GetValue("NzbsOrgHash", String.Empty, true),
|
||||
NzbsrusUId = _configProvider.GetValue("NzbsrusUId", String.Empty, true),
|
||||
NzbsrusHash = _configProvider.GetValue("NzbsrusHash", String.Empty, true),
|
||||
Indexers = _indexerProvider.AllIndexers()
|
||||
});
|
||||
}
|
||||
|
@ -79,12 +79,12 @@ namespace NzbDrone.Web.Controllers
|
|||
SyncFrequency = Convert.ToInt32(_configProvider.GetValue("SyncFrequency", "15", true)),
|
||||
DownloadPropers = Convert.ToBoolean(_configProvider.GetValue("DownloadPropers", "false", true)),
|
||||
Retention = Convert.ToInt32(_configProvider.GetValue("Retention", "500", true)),
|
||||
SabHost = _configProvider.GetValue("SabHost", "localhost", false),
|
||||
SabHost = _configProvider.GetValue("SabHost", "localhost", true),
|
||||
SabPort = Convert.ToInt32(_configProvider.GetValue("SabPort", "8080", true)),
|
||||
SabApiKey = _configProvider.GetValue("SabApiKey", String.Empty, false),
|
||||
SabUsername = _configProvider.GetValue("SabUsername", String.Empty, false),
|
||||
SabPassword = _configProvider.GetValue("SabPassword", String.Empty, false),
|
||||
SabCategory = _configProvider.GetValue("SabCategory", String.Empty, false),
|
||||
SabApiKey = _configProvider.GetValue("SabApiKey", String.Empty, true),
|
||||
SabUsername = _configProvider.GetValue("SabUsername", String.Empty, true),
|
||||
SabPassword = _configProvider.GetValue("SabPassword", String.Empty, true),
|
||||
SabTvCategory = _configProvider.GetValue("SabTvCategory", String.Empty, true),
|
||||
SabPriority = (SabnzbdPriorityType)Enum.Parse(typeof(SabnzbdPriorityType), _configProvider.GetValue("SabPriority", "Normal", true)),
|
||||
};
|
||||
|
||||
|
@ -221,7 +221,7 @@ namespace NzbDrone.Web.Controllers
|
|||
_configProvider.SetValue("SabApiKey", data.SabApiKey);
|
||||
_configProvider.SetValue("SabUsername", data.SabUsername);
|
||||
_configProvider.SetValue("SabPassword", data.SabPassword);
|
||||
_configProvider.SetValue("SabCategory", data.SabCategory);
|
||||
_configProvider.SetValue("SabTvCategory", data.SabTvCategory);
|
||||
_configProvider.SetValue("SabPriority", data.SabPriority.ToString());
|
||||
|
||||
return Content(_settingsSaved);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue