diff --git a/NzbDrone.Core.Test/SabControllerTest.cs b/NzbDrone.Core.Test/SabControllerTest.cs index e29adc6dd..7d2a7763e 100644 --- a/NzbDrone.Core.Test/SabControllerTest.cs +++ b/NzbDrone.Core.Test/SabControllerTest.cs @@ -66,14 +66,30 @@ namespace NzbDrone.Core.Test public void AddByUrlError() { //Setup + string sabHost = "192.168.5.55"; + string sabPort = "2222"; + string apikey = "5c770e3197e4fe763423ee7c392c25d1"; + string username = "admin"; + string password = "pass"; + string priority = "Normal"; + string category = "tv"; + var mocker = new AutoMoqer(); + var fakeConfig = mocker.GetMock(); + fakeConfig.SetupGet(c => c.SabHost) + .Returns(sabHost); + fakeConfig.SetupGet(c => c.SabPort) + .Returns(sabPort); + fakeConfig.SetupGet(c => c.SabApiKey) + .Returns(apikey); + fakeConfig.SetupGet(c => c.SabUsername) .Returns(username); - fakeConfig.Setup(c => c.SabPassword) + fakeConfig.SetupGet(c => c.SabPassword) .Returns(password); - fakeConfig.Setup(c => c.SabTvPriority) + fakeConfig.SetupGet(c => c.SabTvPriority) .Returns(priority); - fakeConfig.Setup(c => c.SabTvCategory) + fakeConfig.SetupGet(c => c.SabTvCategory) .Returns(category); mocker.GetMock() .Setup(s => s.DownloadString(It.IsAny())) diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 8ea75f9a5..80e069d7b 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -168,6 +168,7 @@ + diff --git a/NzbDrone.Core/Providers/SabProvider.cs b/NzbDrone.Core/Providers/SabProvider.cs index 7fb71847d..8669007f4 100644 --- a/NzbDrone.Core/Providers/SabProvider.cs +++ b/NzbDrone.Core/Providers/SabProvider.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Providers string name = url.Replace("&", "%26"); string nzbName = HttpUtility.UrlEncode(title); - string action = string.Format("mode=addurl&name={0}&priority={1}&cat={2}&nzbname={3}", + string action = string.Format("mode=addurl&name={0}&priority={1}&pp=3&cat={2}&nzbname={3}", name, priority, cat, nzbName); string request = GetSabRequest(action); diff --git a/NzbDrone.Web/Content/style.css b/NzbDrone.Web/Content/style.css index 8a49c718d..faf9e0c34 100644 --- a/NzbDrone.Web/Content/style.css +++ b/NzbDrone.Web/Content/style.css @@ -294,4 +294,11 @@ button, input[type="button"], input[type="submit"], input[type="reset"] .Grid { font-size: 13px; +} + +.edit-group +{ + width: 435px; + display: block; + height: 25px; } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 18acf4a13..11cf1c035 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -43,11 +43,12 @@ namespace NzbDrone.Web.Controllers public ActionResult Index() { - ViewData.Model = _seriesProvider.GetAllSeries().ToList(); + var profiles = _qualityProvider.GetAllProfiles(); + ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name"); + return View(); } - public ActionResult RssSync() { _jobProvider.BeginExecute(typeof(RssSyncJob)); @@ -63,6 +64,63 @@ namespace NzbDrone.Web.Controllers }); } + [GridAction] + public ActionResult _AjaxSeriesGrid() + { + var series = new List(); + var seriesInDb = _seriesProvider.GetAllSeries().ToList(); + + seriesInDb.ForEach(s => series.Add(new SeriesModel + { + SeriesId = s.SeriesId, + Title = s.Title, + AirsDayOfWeek = s.AirsDayOfWeek.ToString(), + Monitored = s.Monitored, + Overview = s.Overview, + Path = s.Path, + QualityProfileId = s.QualityProfileId, + QualityProfileName = s.QualityProfile.Name, + SeasonsCount = s.Seasons.Count, + SeasonFolder = s.SeasonFolder, + Status = s.Status + })); + + return View(new GridModel(series)); + } + + [AcceptVerbs(HttpVerbs.Post)] + [GridAction] + public ActionResult _SaveAjaxSeriesEditing(int id, string path, bool monitored, bool seasonFolder, int qualityProfileId) + { + var oldSeries = _seriesProvider.GetSeries(id); + oldSeries.Path = path; + oldSeries.Monitored = monitored; + oldSeries.SeasonFolder = monitored; + oldSeries.QualityProfileId = qualityProfileId; + + _seriesProvider.UpdateSeries(oldSeries); + + var series = new List(); + var seriesInDb = _seriesProvider.GetAllSeries().ToList(); + + seriesInDb.ForEach(s => series.Add(new SeriesModel + { + SeriesId = s.SeriesId, + Title = s.Title, + AirsDayOfWeek = s.AirsDayOfWeek.ToString(), + Monitored = s.Monitored, + Overview = s.Overview, + Path = s.Path, + QualityProfileId = s.QualityProfileId, + QualityProfileName = s.QualityProfile.Name, + SeasonsCount = s.Seasons.Count, + SeasonFolder = s.SeasonFolder, + Status = s.Status + })); + + return View(new GridModel(series)); + } + [GridAction] public ActionResult _AjaxSeasonGrid(int seasonId) { diff --git a/NzbDrone.Web/Models/SeriesModel.cs b/NzbDrone.Web/Models/SeriesModel.cs new file mode 100644 index 000000000..1a9fc704b --- /dev/null +++ b/NzbDrone.Web/Models/SeriesModel.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Web; +using NzbDrone.Core.Repository; + +namespace NzbDrone.Web.Models +{ + public class SeriesModel + { + public int SeriesId { get; set; } + + //View Only + public string Title { get; set; } + public int SeasonsCount { get; set; } + public string Status { get; set; } + public string AirsDayOfWeek { get; set; } + public string QualityProfileName { get; set; } + public string Overview { get; set; } + + //View & Edit + [DisplayName("Path")] + public string Path { get; set; } + + [DisplayName("Quality Profile")] + public virtual int QualityProfileId { get; set; } + + //Editing Only + [DisplayName("Use Season Folder")] + public bool SeasonFolder { get; set; } + + [DisplayName("Monitored")] + public bool Monitored { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 426016b90..70b56a10d 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -240,6 +240,7 @@ + @@ -598,6 +599,7 @@ + @@ -641,6 +643,7 @@ + @@ -835,6 +838,9 @@ + + +