mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
SABnzbd settings will now dynamically get the categories available from SABnzbd when the category drop-box gets focus, it will use values on the page so there is no need to save your settings first.
This commit is contained in:
@@ -3,17 +3,22 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Web.Models;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
{
|
||||
public class CommandController : Controller
|
||||
{
|
||||
private readonly JobProvider _jobProvider;
|
||||
private readonly SabProvider _sabProvider;
|
||||
|
||||
public CommandController(JobProvider jobProvider)
|
||||
public CommandController(JobProvider jobProvider, SabProvider sabProvider)
|
||||
{
|
||||
_jobProvider = jobProvider;
|
||||
_sabProvider = sabProvider;
|
||||
}
|
||||
|
||||
public JsonResult RssSync()
|
||||
@@ -37,5 +42,20 @@ namespace NzbDrone.Web.Controllers
|
||||
|
||||
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult GetSabnzbdCategories(string host, int port, string apiKey, string username, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new JsonResult {Data = _sabProvider.GetCategories(host, port, apiKey, username, password)};
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Todo: Log the error
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ namespace NzbDrone.Web.Controllers
|
||||
|
||||
public ActionResult Sabnzbd()
|
||||
{
|
||||
var sabDropDir = _configProvider.SabDropDirectory;
|
||||
var selectList = new SelectList(new List<string> { sabDropDir }, sabDropDir);
|
||||
var tvCategory = _configProvider.SabTvCategory;
|
||||
var tvCategorySelectList = new SelectList(new[] { tvCategory });
|
||||
|
||||
var model = new SabnzbdSettingsModel
|
||||
{
|
||||
@@ -92,8 +92,8 @@ namespace NzbDrone.Web.Controllers
|
||||
SabPassword = _configProvider.SabPassword,
|
||||
SabTvCategory = _configProvider.SabTvCategory,
|
||||
SabTvPriority = _configProvider.SabTvPriority,
|
||||
SabDropDirectory = sabDropDir,
|
||||
SabDropDirectorySelectList = selectList
|
||||
SabDropDirectory = _configProvider.SabDropDirectory,
|
||||
SabTvCategorySelectList = tvCategorySelectList
|
||||
};
|
||||
|
||||
return View(model);
|
||||
|
||||
Reference in New Issue
Block a user