2011-05-27 06:03:57 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Web.Mvc;
|
2011-12-02 01:33:17 +00:00
|
|
|
|
using NzbDrone.Core.Jobs;
|
2011-05-27 06:03:57 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Providers.Jobs;
|
|
|
|
|
using NzbDrone.Web.Models;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class EpisodeController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly JobProvider _jobProvider;
|
|
|
|
|
|
|
|
|
|
public EpisodeController(JobProvider jobProvider)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_jobProvider = jobProvider;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-22 00:48:37 +00:00
|
|
|
|
[HttpPost]
|
2011-05-27 06:03:57 +00:00
|
|
|
|
public JsonResult Search(int episodeId)
|
|
|
|
|
{
|
|
|
|
|
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-22 00:48:37 +00:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public JsonResult SearchSeason(int seriesId, int seasonNumber)
|
|
|
|
|
{
|
|
|
|
|
_jobProvider.QueueJob(typeof(SeasonSearchJob), seriesId, seasonNumber);
|
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-26 07:53:16 +00:00
|
|
|
|
public JsonResult BacklogSeries(int seriesId)
|
2011-08-23 05:29:12 +00:00
|
|
|
|
{
|
|
|
|
|
//Syncs the episodes on disk for the specified series
|
|
|
|
|
_jobProvider.QueueJob(typeof(SeriesSearchJob), seriesId);
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-06 05:23:28 +00:00
|
|
|
|
public JsonResult Rename(int episodeFileId)
|
|
|
|
|
{
|
|
|
|
|
_jobProvider.QueueJob(typeof(RenameEpisodeJob), episodeFileId);
|
2011-05-27 06:03:57 +00:00
|
|
|
|
|
2011-06-06 05:23:28 +00:00
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
}
|
2011-08-22 00:48:37 +00:00
|
|
|
|
|
|
|
|
|
public JsonResult RenameSeason(int seriesId, int seasonNumber)
|
|
|
|
|
{
|
|
|
|
|
_jobProvider.QueueJob(typeof(RenameSeasonJob), seriesId, seasonNumber);
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
}
|
2011-08-23 05:29:12 +00:00
|
|
|
|
|
2011-11-26 07:53:16 +00:00
|
|
|
|
public JsonResult RenameEpisodes(int seriesId)
|
2011-08-23 05:29:12 +00:00
|
|
|
|
{
|
|
|
|
|
//Syncs the episodes on disk for the specified series
|
|
|
|
|
_jobProvider.QueueJob(typeof(RenameSeriesJob), seriesId);
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
|
|
|
|
}
|
2011-05-27 06:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|