2010-09-23 05:19:47 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
2010-09-28 06:25:41 +02:00
|
|
|
|
using NzbDrone.Core.Providers;
|
2010-09-23 05:19:47 +02:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
|
{
|
2010-10-08 05:35:04 +02:00
|
|
|
|
[HandleError]
|
2010-09-23 05:19:47 +02:00
|
|
|
|
public class SeriesController : Controller
|
|
|
|
|
{
|
2010-09-28 06:25:41 +02:00
|
|
|
|
private readonly ISeriesProvider _seriesProvider;
|
2010-10-05 08:21:18 +02:00
|
|
|
|
private readonly IEpisodeProvider _episodeProvider;
|
2010-09-23 05:19:47 +02:00
|
|
|
|
//
|
|
|
|
|
// GET: /Series/
|
|
|
|
|
|
2010-10-05 08:21:18 +02:00
|
|
|
|
public SeriesController(ISeriesProvider seriesProvider, IEpisodeProvider episodeProvider)
|
2010-09-23 05:19:47 +02:00
|
|
|
|
{
|
2010-09-28 06:25:41 +02:00
|
|
|
|
_seriesProvider = seriesProvider;
|
2010-10-05 08:21:18 +02:00
|
|
|
|
_episodeProvider = episodeProvider;
|
2010-09-23 05:19:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
2010-09-28 06:25:41 +02:00
|
|
|
|
ViewData.Model = _seriesProvider.GetSeries().ToList();
|
2010-09-23 05:19:47 +02:00
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ActionResult Sync()
|
|
|
|
|
{
|
2010-09-28 06:25:41 +02:00
|
|
|
|
_seriesProvider.SyncSeriesWithDisk();
|
2010-09-23 05:19:47 +02:00
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-10-02 21:01:43 +02:00
|
|
|
|
public ActionResult UnMapped()
|
|
|
|
|
{
|
|
|
|
|
_seriesProvider.SyncSeriesWithDisk();
|
|
|
|
|
return View(_seriesProvider.GetUnmappedFolders());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-10-05 08:21:18 +02:00
|
|
|
|
public ActionResult LoadEpisodes(int seriesId)
|
2010-09-23 05:19:47 +02:00
|
|
|
|
{
|
2010-10-05 08:21:18 +02:00
|
|
|
|
_episodeProvider.RefreshSeries(seriesId);
|
|
|
|
|
return RedirectToAction("Details", new
|
2010-09-23 05:19:47 +02:00
|
|
|
|
{
|
2010-10-05 08:21:18 +02:00
|
|
|
|
seriesId = seriesId
|
|
|
|
|
});
|
2010-09-23 05:19:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-08 07:04:25 +02:00
|
|
|
|
public JsonResult MediaDetect()
|
|
|
|
|
{
|
|
|
|
|
Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
|
|
|
|
|
return Json(new { Discovered = disco.DiscoveredMedia }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-08 07:50:01 +02:00
|
|
|
|
public JsonResult LightUpMedia()
|
|
|
|
|
{
|
|
|
|
|
Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
|
|
|
|
|
IMediaProvider p = disco.Providers[0];
|
|
|
|
|
return Json(new { ID = 0, HTML = "<span class='MediaRenderer XBMC'><span class='Play'>Play</span><span class='Pause'>Pause</span><span class='Stop'>Stop</span></span>" }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
public JsonResult ControlMedia()
|
|
|
|
|
{
|
|
|
|
|
Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
|
|
|
|
|
IMediaProvider p = disco.Providers[0];
|
|
|
|
|
string action = Request["Action"];
|
|
|
|
|
switch (action)
|
|
|
|
|
{
|
|
|
|
|
case "Play":
|
|
|
|
|
p.Play();
|
|
|
|
|
break;
|
|
|
|
|
case "Pause":
|
|
|
|
|
p.Pause();
|
|
|
|
|
break;
|
|
|
|
|
case "Stop":
|
|
|
|
|
p.Stop();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return Json(new { Success=true}, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-23 05:19:47 +02:00
|
|
|
|
//
|
2010-10-05 08:21:18 +02:00
|
|
|
|
// GET: /Series/Details/5
|
2010-09-23 05:19:47 +02:00
|
|
|
|
|
2010-10-05 08:21:18 +02:00
|
|
|
|
public ActionResult Details(int seriesId)
|
2010-09-23 05:19:47 +02:00
|
|
|
|
{
|
2010-10-05 08:21:18 +02:00
|
|
|
|
return View(_seriesProvider.GetSeries(seriesId));
|
2010-09-23 05:19:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|