mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -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...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue