@ -5,6 +5,7 @@ using System.Threading;
using System.Web ;
using System.Web.Mvc ;
using NLog ;
using NzbDrone.Core.Model ;
using NzbDrone.Core.Providers ;
using NzbDrone.Core.Repository.Quality ;
using NzbDrone.Web.Models ;
@ -53,7 +54,7 @@ namespace NzbDrone.Web.Controllers
public ActionResult Indexers ( )
{
ViewData [ "viewName" ] = "Indexers" ;
return View ( "Index" , new SettingsModel
return View ( "Index" , new Indexer SettingsModel
{
NzbMatrixUsername = _configProvider . GetValue ( "NzbMatrixUsername" , String . Empty , false ) ,
NzbMatrixApiKey = _configProvider . GetValue ( "NzbMatrixApiKey" , String . Empty , false ) ,
@ -68,19 +69,9 @@ namespace NzbDrone.Web.Controllers
public ActionResult Downloads ( )
{
ViewData [ "viewName" ] = "Downloads" ;
return View ( "Index" , new SettingsModel
{
//Sync Frequency
//Download Propers?
//Retention
//SAB Host/IP
//SAB Port
//SAB APIKey
//SAB Username
//SAB Password
//SAB Category
//SAB Priority
var model = new DownloadSettingsModel
{
SyncFrequency = Convert . ToInt32 ( _configProvider . GetValue ( "SyncFrequency" , "15" , true ) ) ,
DownloadPropers = Convert . ToBoolean ( _configProvider . GetValue ( "DownloadPropers" , "false" , true ) ) ,
Retention = Convert . ToInt32 ( _configProvider . GetValue ( "Retention" , "500" , true ) ) ,
@ -90,8 +81,10 @@ namespace NzbDrone.Web.Controllers
SabUsername = _configProvider . GetValue ( "SabUsername" , String . Empty , false ) ,
SabPassword = _configProvider . GetValue ( "SabPassword" , String . Empty , false ) ,
SabCategory = _configProvider . GetValue ( "SabCategory" , String . Empty , false ) ,
//SabPriority = _configProvider.GetValue("SabPriority", String.Empty, false)
} ) ;
SabPriority = ( SabnzbdPriorityType ) Enum . Parse ( typeof ( SabnzbdPriorityType ) , _configProvider . GetValue ( "SabPriority" , "Normal" , true ) ) ,
} ;
return View ( "Index" , model ) ;
}
public ActionResult Quality ( )
@ -150,10 +143,6 @@ namespace NzbDrone.Web.Controllers
try
{
_configProvider . SeriesRoot = data . TvFolder ;
_configProvider . SetValue ( "NzbMatrixUsername" , data . NzbMatrixUsername ) ;
_configProvider . SetValue ( "NzbMatrixApiKey" , data . NzbMatrixApiKey ) ;
_configProvider . SetValue ( "NzbsOrgUId" , data . NzbsOrgUId ) ;
_configProvider . SetValue ( "NzbsOrgHash" , data . NzbsOrgHash ) ;
}
catch ( Exception )
{
@ -199,7 +188,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public ActionResult SaveIndexers ( SettingsModel data )
public ActionResult SaveIndexers ( Indexer SettingsModel data )
{
try
{
@ -245,7 +234,9 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public ActionResult SaveDownloads ( SettingsModel data )
public ActionResult SaveDownloads ( DownloadSettingsModel data )
{
if ( ModelState . IsValid )
{
try
{
@ -275,9 +266,14 @@ namespace NzbDrone.Web.Controllers
if ( data . SabCategory ! = null )
_configProvider . SetValue ( "SabCategory" , data . SabCategory ) ;
//if (data.SabPriority != null)
// _configProvider.SetValue("SabPriority", data.SabPriority.ToString());
_configProvider . SetValue ( "SabPriority" , data . SabPriority . ToString ( ) ) ;
if ( Request . IsAjaxRequest ( ) )
return Content ( "Settings Saved." ) ;
return Content ( "Settings Saved." ) ;
}
catch ( Exception e )
{
Logger . ErrorException ( e . Message , e ) ;
@ -286,11 +282,11 @@ namespace NzbDrone.Web.Controllers
return Content ( "Error Saving Settings, please fix any errors" ) ;
}
}
if ( Request . IsAjaxRequest ( ) )
return Content ( "Settings Saved." ) ;
return Content ( "Settings Saved." ) ;
//ViewData["viewName"] = "Downloads";
//return View("Index", data);
return Content ( "Error Saving Settings, please fix any errors" ) ;
}
[HttpPost]
@ -334,6 +330,7 @@ namespace NzbDrone.Web.Controllers
catch ( Exception e )
{
Logger . ErrorException ( e . Message , e ) ;
if ( Request . IsAjaxRequest ( ) )
return Content ( "Error Saving Settings, please fix any errors" ) ;