Post Processor Done.

Will send from SAB to NzbDrone.
Changed SabCategory to SabTvCategory (Support for movies later?)
This commit is contained in:
markus101 2011-03-06 14:27:52 -08:00
commit 70fd11231d
9 changed files with 124 additions and 26 deletions

View file

@ -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...");
}
}
}