1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00
Radarr/NzbDrone.Web/Controllers/ApiController.cs
markus101 70fd11231d Post Processor Done.
Will send from SAB to NzbDrone.
Changed SabCategory to SabTvCategory (Support for movies later?)
2011-03-06 14:27:52 -08:00

44 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;
using NLog;
using NzbDrone.Core;
using NzbDrone.Core.Providers;
namespace NzbDrone.Web.Controllers
{
public class ApiController : Controller
{
private readonly IPostProcessingProvider _postProcessingProvider;
private readonly IConfigProvider _configProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public ApiController(IPostProcessingProvider postProcessingProvider, IConfigProvider configProvider)
{
_postProcessingProvider = postProcessingProvider;
_configProvider = configProvider;
}
public ActionResult ProcessEpisode(string apiKey, string dir, string nzbName, string category)
{
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...");
}
}
}