1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00
Sonarr/NzbDrone.Web/Controllers/ApiController.cs

37 lines
1.2 KiB
C#
Raw Normal View History

2011-04-10 05:44:01 +03:00
using System.Web.Mvc;
using NLog;
using NzbDrone.Core.Providers;
2011-04-04 06:50:12 +03:00
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Web.Controllers
{
public class ApiController : Controller
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
2011-04-10 05:44:01 +03:00
private readonly ConfigProvider _configProvider;
private readonly PostProcessingProvider _postProcessingProvider;
public ApiController(PostProcessingProvider postProcessingProvider, ConfigProvider configProvider)
{
_postProcessingProvider = postProcessingProvider;
_configProvider = configProvider;
}
public ActionResult ProcessEpisode(string apiKey, string dir, string nzbName, string category)
{
if (apiKey != _configProvider.ApiKey)
{
Logger.Warn("API Key from Post Processing Script is Invalid");
return Content("Invalid API Key");
}
if (_configProvider.SabTvCategory == category)
{
_postProcessingProvider.ProcessEpisode(dir, nzbName);
return Content("ok");
}
return Content("Category doesn't match what was configured for SAB TV Category...");
}
}
2011-04-10 05:44:01 +03:00
}