1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/NzbDrone.Web/Controllers/EpisodeController.cs

74 lines
2.4 KiB
C#
Raw Normal View History

using System;
using System.Web.Mvc;
2011-12-02 04:33:17 +03:00
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository.Quality;
2011-05-27 09:03:57 +03:00
using NzbDrone.Web.Models;
namespace NzbDrone.Web.Controllers
{
public class EpisodeController : Controller
{
private readonly JobProvider _jobProvider;
private readonly MediaFileProvider _mediaFileProvider;
2011-05-27 09:03:57 +03:00
public EpisodeController(JobProvider jobProvider, MediaFileProvider mediaFileProvider)
2011-05-27 09:03:57 +03:00
{
_jobProvider = jobProvider;
_mediaFileProvider = mediaFileProvider;
2011-05-27 09:03:57 +03:00
}
public JsonResult Search(int episodeId)
{
_jobProvider.QueueJob(typeof(EpisodeSearchJob), new { EpisodeId = episodeId });
return JsonNotificationResult.Queued("Episode search");
2011-05-27 09:03:57 +03:00
}
public JsonResult SearchSeason(int seriesId, int seasonNumber)
{
2012-09-10 22:04:17 +03:00
_jobProvider.QueueJob(typeof(SeasonSearchJob), new { SeriesId = seriesId, SeasonNumber = seasonNumber });
return JsonNotificationResult.Queued("Season search");
}
2011-11-26 10:53:16 +03:00
public JsonResult BacklogSeries(int seriesId)
{
_jobProvider.QueueJob(typeof(SeriesSearchJob), new { SeriesId = seriesId });
return JsonNotificationResult.Queued("Series Backlog");
}
public JsonResult RenameSeason(int seriesId, int seasonNumber)
{
2012-09-10 22:04:17 +03:00
_jobProvider.QueueJob(typeof(RenameSeasonJob), new { SeriesId = seriesId, SeasonNumber = seasonNumber });
return JsonNotificationResult.Queued("Season rename");
}
public JsonResult RenameSeries(int seriesId)
{
_jobProvider.QueueJob(typeof(RenameSeriesJob), new { SeriesId = seriesId });
return JsonNotificationResult.Queued("Series rename");
}
public JsonResult RenameAllSeries()
{
_jobProvider.QueueJob(typeof(RenameSeriesJob));
return JsonNotificationResult.Queued("Series rename");
}
[HttpPost]
public JsonResult ChangeEpisodeQuality(int episodeFileId, QualityTypes quality)
{
_mediaFileProvider.ChangeQuality(episodeFileId, quality);
return Json("ok");
}
[HttpPost]
public JsonResult ChangeSeasonQuality(int seriesId, int seasonNumber, QualityTypes quality)
{
_mediaFileProvider.ChangeQuality(seriesId, seasonNumber, quality);
return Json("ok");
}
2011-05-27 09:03:57 +03:00
}
}