@ -9,6 +9,7 @@ using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification ;
using NzbDrone.Core.Providers ;
using NzbDrone.Core.Providers.Core ;
using NzbDrone.Core.Providers.ExternalNotification ;
using NzbDrone.Core.Providers.Indexer ;
using NzbDrone.Core.Repository ;
using NzbDrone.Core.Repository.Quality ;
@ -30,12 +31,16 @@ namespace NzbDrone.Web.Controllers
private readonly NotificationProvider _notificationProvider ;
private readonly DiskProvider _diskProvider ;
private readonly SeriesProvider _seriesProvider ;
private readonly ExternalNotificationProvider _externalNotificationProvider ;
private readonly ProgressNotification _progressNotification ;
public SettingsController ( ConfigProvider configProvider , IndexerProvider indexerProvider ,
QualityProvider qualityProvider , RootDirProvider rootDirProvider ,
AutoConfigureProvider autoConfigureProvider , NotificationProvider notificationProvider ,
DiskProvider diskProvider , SeriesProvider seriesProvider )
DiskProvider diskProvider , SeriesProvider seriesProvider ,
ExternalNotificationProvider externalNotificationProvider )
{
_externalNotificationProvider = externalNotificationProvider ;
_configProvider = configProvider ;
_indexerProvider = indexerProvider ;
_qualityProvider = qualityProvider ;
@ -44,6 +49,8 @@ namespace NzbDrone.Web.Controllers
_notificationProvider = notificationProvider ;
_diskProvider = diskProvider ;
_seriesProvider = seriesProvider ;
_progressNotification = new ProgressNotification ( "Settings" ) ;
}
public ActionResult Test ( )
@ -140,7 +147,7 @@ namespace NzbDrone.Web.Controllers
{
var model = new NotificationSettingsModel
{
XbmcEnabled = _ configProvider. XbmcEnabled ,
XbmcEnabled = _ externalNotificationProvider. GetSettings ( typeof ( Xbmc ) ) . Enable ,
XbmcNotifyOnGrab = _configProvider . XbmcNotifyOnGrab ,
XbmcNotifyOnDownload = _configProvider . XbmcNotifyOnDownload ,
XbmcUpdateLibrary = _configProvider . XbmcUpdateLibrary ,
@ -262,14 +269,11 @@ namespace NzbDrone.Web.Controllers
return new JsonResult { Data = "failed" } ;
}
}
[HttpPost]
public ActionResult SaveIndexers ( IndexerSettingsModel data )
{
var basicNotification = new BasicNotification ( ) ;
basicNotification . Type = BasicNotificationType . Info ;
basicNotification . AutoDismiss = true ;
_notificationProvider . Register ( _progressNotification ) ;
if ( ModelState . IsValid )
{
@ -301,22 +305,20 @@ namespace NzbDrone.Web.Controllers
_configProvider . NewzbinUsername = data . NewzbinUsername ;
_configProvider . NewzbinPassword = data . NewzbinPassword ;
basicNotification. Titl e = SETTINGS_SAVED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_SAVED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_SAVED ) ;
}
basicNotification. Titl e = SETTINGS_FAILED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_FAILED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_FAILED ) ;
}
[HttpPost]
public ActionResult SaveSabnzbd ( SabnzbdSettingsModel data )
{
var basicNotification = new BasicNotification ( ) ;
basicNotification . Type = BasicNotificationType . Info ;
basicNotification . AutoDismiss = true ;
_notificationProvider . Register ( _progressNotification ) ;
if ( ModelState . IsValid )
{
@ -329,22 +331,20 @@ namespace NzbDrone.Web.Controllers
_configProvider . SabTvPriority = data . SabTvPriority ;
_configProvider . SabDropDirectory = data . SabDropDirectory ;
basicNotification. Titl e = SETTINGS_SAVED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_SAVED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_SAVED ) ;
}
basicNotification. Titl e = SETTINGS_FAILED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_FAILED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_FAILED ) ;
}
[HttpPost]
public ActionResult SaveQuality ( QualityModel data )
{
var basicNotification = new BasicNotification ( ) ;
basicNotification . Type = BasicNotificationType . Info ;
basicNotification . AutoDismiss = true ;
_notificationProvider . Register ( _progressNotification ) ;
if ( ModelState . IsValid )
{
@ -376,26 +376,29 @@ namespace NzbDrone.Web.Controllers
_qualityProvider . Update ( profile ) ;
}
basicNotification . Title = SETTINGS_SAVED ;
_notificationProvider . Register ( basicNotification ) ;
_progressNotification . CurrentMessage = SETTINGS_SAVED ;
_progressNotification . Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_SAVED ) ;
}
basicNotification. Titl e = SETTINGS_FAILED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_FAILED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_FAILED ) ;
}
[HttpPost]
public ActionResult SaveNotifications ( NotificationSettingsModel data )
{
var basicNotification = new BasicNotification ( ) ;
basicNotification . Type = BasicNotificationType . Info ;
basicNotification . AutoDismiss = true ;
_notificationProvider . Register ( _progressNotification ) ;
if ( ModelState . IsValid )
{
_configProvider . XbmcEnabled = data . XbmcEnabled ;
//XBMC Enabled
var xbmcSettings = _externalNotificationProvider . GetSettings ( typeof ( Xbmc ) ) ;
xbmcSettings . Enable = data . XbmcEnabled ;
_externalNotificationProvider . SaveSettings ( xbmcSettings ) ;
_configProvider . XbmcNotifyOnGrab = data . XbmcNotifyOnGrab ;
_configProvider . XbmcNotifyOnDownload = data . XbmcNotifyOnDownload ;
_configProvider . XbmcUpdateLibrary = data . XbmcUpdateLibrary ;
@ -404,22 +407,20 @@ namespace NzbDrone.Web.Controllers
_configProvider . XbmcUsername = data . XbmcUsername ;
_configProvider . XbmcPassword = data . XbmcPassword ;
basicNotification. Titl e = SETTINGS_SAVED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_SAVED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_SAVED ) ;
}
basicNotification. Titl e = SETTINGS_FAILED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_FAILED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_FAILED ) ;
}
[HttpPost]
public ActionResult SaveEpisodeSorting ( EpisodeSortingModel data )
{
var basicNotification = new BasicNotification ( ) ;
basicNotification . Type = BasicNotificationType . Info ;
basicNotification . AutoDismiss = true ;
_notificationProvider . Register ( _progressNotification ) ;
if ( ModelState . IsValid )
{
@ -433,13 +434,13 @@ namespace NzbDrone.Web.Controllers
_configProvider . SortingNumberStyle = data . NumberStyle ;
_configProvider . SortingMultiEpisodeStyle = data . MultiEpisodeStyle ;
basicNotification. Titl e = SETTINGS_SAVED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_SAVED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_SAVED ) ;
}
basicNotification. Titl e = SETTINGS_FAILED ;
_ notificationProvider. Register ( basicNotification ) ;
_progressNotification. CurrentMessag e = SETTINGS_FAILED ;
_ progressNotification. Status = ProgressNotificationStatus . Completed ;
return Content ( SETTINGS_FAILED ) ;
}
}