2010-09-23 03:19:47 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2011-05-14 07:49:57 +00:00
|
|
|
|
using System.IO;
|
2010-09-23 03:19:47 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
using NLog;
|
2011-11-13 07:27:16 +00:00
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
using NzbDrone.Common.Model;
|
2011-03-03 08:50:33 +00:00
|
|
|
|
using NzbDrone.Core.Helpers;
|
2011-02-11 01:22:29 +00:00
|
|
|
|
using NzbDrone.Core.Model;
|
2011-05-13 04:46:26 +00:00
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
2011-02-05 06:07:25 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
2011-04-04 03:50:12 +00:00
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
2011-07-28 07:21:49 +00:00
|
|
|
|
using NzbDrone.Core.Providers.ExternalNotification;
|
2011-04-19 00:12:06 +00:00
|
|
|
|
using NzbDrone.Core.Providers.Indexer;
|
2011-03-09 07:40:48 +00:00
|
|
|
|
using NzbDrone.Core.Repository;
|
2011-02-05 06:07:25 +00:00
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
2010-09-24 05:21:45 +00:00
|
|
|
|
using NzbDrone.Web.Models;
|
2010-09-23 03:19:47 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
|
{
|
2010-10-08 03:35:04 +00:00
|
|
|
|
[HandleError]
|
2010-09-23 03:19:47 +00:00
|
|
|
|
public class SettingsController : Controller
|
|
|
|
|
{
|
2011-04-10 02:44:01 +00:00
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
private readonly ConfigProvider _configProvider;
|
|
|
|
|
private readonly IndexerProvider _indexerProvider;
|
|
|
|
|
private readonly QualityProvider _qualityProvider;
|
2011-04-25 07:42:29 +00:00
|
|
|
|
private readonly AutoConfigureProvider _autoConfigureProvider;
|
2011-05-29 04:07:11 +00:00
|
|
|
|
private readonly SeriesProvider _seriesProvider;
|
2011-07-28 07:21:49 +00:00
|
|
|
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
2011-09-16 04:42:30 +00:00
|
|
|
|
private readonly QualityTypeProvider _qualityTypeProvider;
|
2011-09-23 00:18:41 +00:00
|
|
|
|
private readonly RootDirProvider _rootDirProvider;
|
2011-10-01 07:04:06 +00:00
|
|
|
|
private readonly ConfigFileProvider _configFileProvider;
|
2011-11-13 20:51:15 +00:00
|
|
|
|
private readonly NewznabProvider _newznabProvider;
|
2010-09-24 05:21:45 +00:00
|
|
|
|
|
2011-04-10 01:34:36 +00:00
|
|
|
|
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
2011-08-08 21:50:48 +00:00
|
|
|
|
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
|
2011-09-16 04:42:30 +00:00
|
|
|
|
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
|
2011-10-01 07:04:06 +00:00
|
|
|
|
QualityTypeProvider qualityTypeProvider, RootDirProvider rootDirProvider,
|
2011-11-13 20:51:15 +00:00
|
|
|
|
ConfigFileProvider configFileProvider, NewznabProvider newznabProvider)
|
2010-09-24 05:21:45 +00:00
|
|
|
|
{
|
2011-07-28 07:21:49 +00:00
|
|
|
|
_externalNotificationProvider = externalNotificationProvider;
|
2011-09-16 04:42:30 +00:00
|
|
|
|
_qualityTypeProvider = qualityTypeProvider;
|
2011-09-23 00:18:41 +00:00
|
|
|
|
_rootDirProvider = rootDirProvider;
|
2011-10-01 07:04:06 +00:00
|
|
|
|
_configFileProvider = configFileProvider;
|
2011-11-13 20:51:15 +00:00
|
|
|
|
_newznabProvider = newznabProvider;
|
2010-09-28 04:25:41 +00:00
|
|
|
|
_configProvider = configProvider;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
_indexerProvider = indexerProvider;
|
2011-02-03 02:49:52 +00:00
|
|
|
|
_qualityProvider = qualityProvider;
|
2011-04-25 07:42:29 +00:00
|
|
|
|
_autoConfigureProvider = autoConfigureProvider;
|
2011-05-29 04:07:11 +00:00
|
|
|
|
_seriesProvider = seriesProvider;
|
2010-09-24 05:21:45 +00:00
|
|
|
|
}
|
2010-09-23 03:19:47 +00:00
|
|
|
|
|
2011-05-16 06:27:02 +00:00
|
|
|
|
public ActionResult Test()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-09 03:26:48 +00:00
|
|
|
|
public JsonResult TestResults(string q)
|
2011-05-16 06:27:02 +00:00
|
|
|
|
{
|
2011-09-09 03:26:48 +00:00
|
|
|
|
var results = new List<TvDbSearchResultModel>();
|
|
|
|
|
results.Add(new TvDbSearchResultModel { Id = 1, Title = "30 Rock", FirstAired = DateTime.Today.ToShortDateString() });
|
|
|
|
|
results.Add(new TvDbSearchResultModel { Id = 2, Title = "The Office", FirstAired = DateTime.Today.AddDays(-1).ToShortDateString() });
|
|
|
|
|
|
|
|
|
|
return Json(results, JsonRequestBehavior.AllowGet );
|
2011-05-16 06:27:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-01 20:33:03 +00:00
|
|
|
|
public ActionResult Index()
|
2010-09-23 03:19:47 +00:00
|
|
|
|
{
|
2011-07-01 20:33:03 +00:00
|
|
|
|
return RedirectToAction("Indexers");
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Indexers()
|
|
|
|
|
{
|
2011-07-01 20:33:03 +00:00
|
|
|
|
return View(new IndexerSettingsModel
|
2011-08-08 21:50:48 +00:00
|
|
|
|
{
|
|
|
|
|
NzbMatrixUsername = _configProvider.NzbMatrixUsername,
|
|
|
|
|
NzbMatrixApiKey = _configProvider.NzbMatrixApiKey,
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
NzbsrusUId = _configProvider.NzbsrusUId,
|
|
|
|
|
NzbsrusHash = _configProvider.NzbsrusHash,
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
NzbsOrgHash = _configProvider.NzbsOrgHash,
|
|
|
|
|
NzbsOrgUId = _configProvider.NzbsOrgUId,
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
NewzbinUsername = _configProvider.NewzbinUsername,
|
|
|
|
|
NewzbinPassword = _configProvider.NewzbinPassword,
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
NzbsOrgEnabled = _indexerProvider.GetSettings(typeof(NzbsOrg)).Enable,
|
|
|
|
|
NzbMatrixEnabled = _indexerProvider.GetSettings(typeof(NzbMatrix)).Enable,
|
|
|
|
|
NzbsRUsEnabled = _indexerProvider.GetSettings(typeof(NzbsRUs)).Enable,
|
2011-11-13 20:51:15 +00:00
|
|
|
|
NewzbinEnabled = _indexerProvider.GetSettings(typeof(Newzbin)).Enable,
|
2011-11-16 00:45:22 +00:00
|
|
|
|
NewznabEnabled = _indexerProvider.GetSettings(typeof(Newznab)).Enable,
|
2011-11-13 20:51:15 +00:00
|
|
|
|
|
|
|
|
|
NewznabDefinitions = _newznabProvider.All(),
|
2011-08-08 21:50:48 +00:00
|
|
|
|
});
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
|
public ActionResult Sabnzbd()
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
2011-08-26 17:45:59 +00:00
|
|
|
|
var tvCategory = _configProvider.SabTvCategory;
|
|
|
|
|
var tvCategorySelectList = new SelectList(new[] { tvCategory });
|
2011-06-09 01:45:06 +00:00
|
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
|
var model = new SabnzbdSettingsModel
|
2011-02-11 01:22:29 +00:00
|
|
|
|
{
|
2011-04-25 19:02:29 +00:00
|
|
|
|
SabHost = _configProvider.SabHost,
|
2011-08-08 21:50:48 +00:00
|
|
|
|
SabPort = _configProvider.SabPort,
|
2011-04-25 19:02:29 +00:00
|
|
|
|
SabApiKey = _configProvider.SabApiKey,
|
|
|
|
|
SabUsername = _configProvider.SabUsername,
|
|
|
|
|
SabPassword = _configProvider.SabPassword,
|
2011-11-03 02:44:22 +00:00
|
|
|
|
SabTvCategory = tvCategory,
|
2011-05-16 07:32:01 +00:00
|
|
|
|
SabTvPriority = _configProvider.SabTvPriority,
|
2011-08-26 17:45:59 +00:00
|
|
|
|
SabDropDirectory = _configProvider.SabDropDirectory,
|
|
|
|
|
SabTvCategorySelectList = tvCategorySelectList
|
2011-02-11 01:22:29 +00:00
|
|
|
|
};
|
|
|
|
|
|
2011-06-30 05:22:34 +00:00
|
|
|
|
return View(model);
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 02:49:52 +00:00
|
|
|
|
public ActionResult Quality()
|
|
|
|
|
{
|
2011-02-05 06:07:25 +00:00
|
|
|
|
var qualityTypes = new List<QualityTypes>();
|
2011-02-03 02:49:52 +00:00
|
|
|
|
|
2011-04-19 00:12:06 +00:00
|
|
|
|
foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes)))
|
2011-02-05 06:07:25 +00:00
|
|
|
|
{
|
|
|
|
|
qualityTypes.Add(qual);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-06 02:52:49 +00:00
|
|
|
|
ViewData["Qualities"] = qualityTypes;
|
|
|
|
|
|
2011-07-08 05:41:08 +00:00
|
|
|
|
var profiles = _qualityProvider.All().ToList();
|
2011-07-01 09:10:42 +00:00
|
|
|
|
|
|
|
|
|
foreach (var qualityProfile in profiles)
|
|
|
|
|
{
|
|
|
|
|
qualityProfile.AllowedString = string.Join(",", qualityProfile.Allowed);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
|
var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
2011-05-29 08:59:25 +00:00
|
|
|
|
var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name");
|
2011-09-16 04:42:30 +00:00
|
|
|
|
var qualityTypesFromDb = _qualityTypeProvider.All();
|
2011-02-05 06:07:25 +00:00
|
|
|
|
|
|
|
|
|
var model = new QualityModel
|
2011-04-10 02:44:01 +00:00
|
|
|
|
{
|
|
|
|
|
Profiles = profiles,
|
|
|
|
|
DefaultQualityProfileId = defaultQualityQualityProfileId,
|
2011-09-16 04:42:30 +00:00
|
|
|
|
QualityProfileSelectList = qualityProfileSelectList,
|
|
|
|
|
SdtvMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 1).MaxSize,
|
|
|
|
|
DvdMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 2).MaxSize,
|
|
|
|
|
HdtvMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 4).MaxSize,
|
|
|
|
|
WebdlMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 5).MaxSize,
|
|
|
|
|
Bluray720pMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 6).MaxSize,
|
|
|
|
|
Bluray1080pMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 7).MaxSize
|
2011-04-10 02:44:01 +00:00
|
|
|
|
};
|
2011-02-03 02:49:52 +00:00
|
|
|
|
|
2011-06-30 05:22:34 +00:00
|
|
|
|
return View(model);
|
2011-02-03 02:49:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-07 07:32:36 +00:00
|
|
|
|
public ActionResult Notifications()
|
|
|
|
|
{
|
|
|
|
|
var model = new NotificationSettingsModel
|
2011-04-10 02:44:01 +00:00
|
|
|
|
{
|
2011-07-28 07:21:49 +00:00
|
|
|
|
XbmcEnabled = _externalNotificationProvider.GetSettings(typeof(Xbmc)).Enable,
|
2011-07-09 18:19:33 +00:00
|
|
|
|
XbmcNotifyOnGrab = _configProvider.XbmcNotifyOnGrab,
|
|
|
|
|
XbmcNotifyOnDownload = _configProvider.XbmcNotifyOnDownload,
|
|
|
|
|
XbmcUpdateLibrary = _configProvider.XbmcUpdateLibrary,
|
|
|
|
|
XbmcCleanLibrary = _configProvider.XbmcCleanLibrary,
|
|
|
|
|
XbmcHosts = _configProvider.XbmcHosts,
|
|
|
|
|
XbmcUsername = _configProvider.XbmcUsername,
|
2011-10-27 05:46:54 +00:00
|
|
|
|
XbmcPassword = _configProvider.XbmcPassword,
|
|
|
|
|
SmtpEnabled = _externalNotificationProvider.GetSettings(typeof(Smtp)).Enable,
|
|
|
|
|
SmtpNotifyOnGrab = _configProvider.SmtpNotifyOnGrab,
|
|
|
|
|
SmtpNotifyOnDownload = _configProvider.SmtpNotifyOnGrab,
|
|
|
|
|
SmtpServer = _configProvider.SmtpServer,
|
|
|
|
|
SmtpPort = _configProvider.SmtpPort,
|
|
|
|
|
SmtpUseSsl = _configProvider.SmtpUseSsl,
|
|
|
|
|
SmtpUsername = _configProvider.SmtpUsername,
|
|
|
|
|
SmtpPassword = _configProvider.SmtpPassword,
|
|
|
|
|
SmtpFromAddress = _configProvider.SmtpFromAddress,
|
2011-10-28 08:14:13 +00:00
|
|
|
|
SmtpToAddresses = _configProvider.SmtpToAddresses,
|
|
|
|
|
TwitterEnabled = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable,
|
|
|
|
|
TwitterNotifyOnGrab = _configProvider.TwitterNotifyOnGrab,
|
2011-11-02 07:09:52 +00:00
|
|
|
|
TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload,
|
|
|
|
|
GrowlEnabled = _externalNotificationProvider.GetSettings(typeof(Growl)).Enable,
|
|
|
|
|
GrowlNotifyOnGrab = _configProvider.GrowlNotifyOnGrab,
|
|
|
|
|
GrowlNotifyOnDownload = _configProvider.GrowlNotifyOnDownload,
|
|
|
|
|
GrowlHost = _configProvider.GrowlHost,
|
2011-11-03 02:44:22 +00:00
|
|
|
|
GrowlPassword = _configProvider.GrowlPassword,
|
|
|
|
|
ProwlEnabled = _externalNotificationProvider.GetSettings(typeof(Prowl)).Enable,
|
|
|
|
|
ProwlNotifyOnGrab = _configProvider.ProwlNotifyOnGrab,
|
|
|
|
|
ProwlNotifyOnDownload = _configProvider.ProwlNotifyOnDownload,
|
|
|
|
|
ProwlApiKeys = _configProvider.ProwlApiKeys,
|
|
|
|
|
ProwlPriority = _configProvider.ProwlPriority,
|
|
|
|
|
ProwlPrioritySelectList = GetProwlPrioritySelectList()
|
2011-04-10 02:44:01 +00:00
|
|
|
|
};
|
2011-03-07 07:32:36 +00:00
|
|
|
|
|
2011-07-01 20:33:03 +00:00
|
|
|
|
return View(model);
|
2011-03-07 07:32:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-29 01:11:55 +00:00
|
|
|
|
public ActionResult Naming()
|
2011-02-26 04:07:22 +00:00
|
|
|
|
{
|
2011-11-29 01:11:55 +00:00
|
|
|
|
var model = new EpisodeNamingModel();
|
2011-02-26 04:07:22 +00:00
|
|
|
|
|
2011-07-08 03:36:02 +00:00
|
|
|
|
model.SeriesName = _configProvider.SortingIncludeSeriesName;
|
2011-07-08 03:57:44 +00:00
|
|
|
|
model.EpisodeName = _configProvider.SortingIncludeEpisodeTitle;
|
2011-07-08 03:36:02 +00:00
|
|
|
|
model.ReplaceSpaces = _configProvider.SortingReplaceSpaces;
|
|
|
|
|
model.AppendQuality = _configProvider.SortingAppendQuality;
|
2011-04-01 06:36:34 +00:00
|
|
|
|
model.SeasonFolders = _configProvider.UseSeasonFolder;
|
2011-07-08 03:36:02 +00:00
|
|
|
|
model.SeasonFolderFormat = _configProvider.SortingSeasonFolderFormat;
|
|
|
|
|
model.SeparatorStyle = _configProvider.SortingSeparatorStyle;
|
|
|
|
|
model.NumberStyle = _configProvider.SortingNumberStyle;
|
|
|
|
|
model.MultiEpisodeStyle = _configProvider.SortingMultiEpisodeStyle;
|
2011-02-26 04:07:22 +00:00
|
|
|
|
|
|
|
|
|
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
|
|
|
|
|
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
|
|
|
|
|
model.MultiEpisodeStyles = new SelectList(EpisodeSortingHelper.GetMultiEpisodeStyles(), "Id", "Name");
|
|
|
|
|
|
2011-07-01 20:33:03 +00:00
|
|
|
|
return View(model);
|
2011-02-26 04:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-01 07:04:06 +00:00
|
|
|
|
public ActionResult System()
|
|
|
|
|
{
|
2011-10-07 23:24:28 +00:00
|
|
|
|
var selectedAuthenticationType = _configFileProvider.AuthenticationType;
|
|
|
|
|
var authenticationTypes = new List<AuthenticationType>();
|
|
|
|
|
|
|
|
|
|
foreach (AuthenticationType authenticationType in Enum.GetValues(typeof(AuthenticationType)))
|
|
|
|
|
{
|
|
|
|
|
authenticationTypes.Add(authenticationType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var authTypeSelectList = new SelectList(authenticationTypes, selectedAuthenticationType);
|
|
|
|
|
|
2011-10-01 07:04:06 +00:00
|
|
|
|
var model = new SystemSettingsModel();
|
|
|
|
|
model.Port = _configFileProvider.Port;
|
|
|
|
|
model.LaunchBrowser = _configFileProvider.LaunchBrowser;
|
2011-10-07 23:24:28 +00:00
|
|
|
|
model.AuthenticationType = selectedAuthenticationType;
|
|
|
|
|
model.AuthTypeSelectList = authTypeSelectList;
|
2011-10-01 07:04:06 +00:00
|
|
|
|
|
|
|
|
|
return View(model);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
|
public ViewResult AddProfile()
|
2011-02-05 18:27:14 +00:00
|
|
|
|
{
|
2011-02-06 07:13:17 +00:00
|
|
|
|
var qualityTypes = new List<QualityTypes>();
|
|
|
|
|
|
2011-04-19 00:12:06 +00:00
|
|
|
|
foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes)))
|
2011-02-06 07:13:17 +00:00
|
|
|
|
{
|
|
|
|
|
qualityTypes.Add(qual);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-29 22:44:05 +00:00
|
|
|
|
ViewData["Qualities"] = qualityTypes;
|
2011-02-06 07:13:17 +00:00
|
|
|
|
|
2011-04-22 00:30:19 +00:00
|
|
|
|
var qualityProfile = new QualityProfile
|
|
|
|
|
{
|
|
|
|
|
Name = "New Profile",
|
2011-04-22 17:09:06 +00:00
|
|
|
|
Allowed = new List<QualityTypes> { QualityTypes.Unknown },
|
2011-07-01 09:10:42 +00:00
|
|
|
|
Cutoff = QualityTypes.Unknown
|
2011-04-22 00:30:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var id = _qualityProvider.Add(qualityProfile);
|
|
|
|
|
qualityProfile.QualityProfileId = id;
|
2011-07-01 09:10:42 +00:00
|
|
|
|
qualityProfile.AllowedString = "Unknown";
|
2011-04-22 00:30:19 +00:00
|
|
|
|
|
|
|
|
|
ViewData["ProfileId"] = id;
|
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
|
return View("QualityProfileItem", qualityProfile);
|
2011-04-22 00:30:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult GetQualityProfileView(QualityProfile profile)
|
|
|
|
|
{
|
|
|
|
|
var qualityTypes = new List<QualityTypes>();
|
|
|
|
|
|
|
|
|
|
foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes)))
|
|
|
|
|
{
|
|
|
|
|
qualityTypes.Add(qual);
|
|
|
|
|
}
|
2011-05-29 08:59:25 +00:00
|
|
|
|
|
2011-04-22 00:30:19 +00:00
|
|
|
|
ViewData["Qualities"] = qualityTypes;
|
|
|
|
|
ViewData["ProfileId"] = profile.QualityProfileId;
|
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
|
return PartialView("QualityProfileItem", profile);
|
2011-02-05 18:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-13 20:51:15 +00:00
|
|
|
|
public JsonResult DeleteQualityProfile(int profileId)
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
2011-11-13 20:51:15 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
|
|
|
|
|
return new JsonResult { Data = "Unable to delete Profile, it is still in use." };
|
|
|
|
|
|
|
|
|
|
_qualityProvider.Delete(profileId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new JsonResult { Data = "ok" };
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-15 23:11:17 +00:00
|
|
|
|
public PartialViewResult AddNewznabProvider()
|
2011-02-12 06:10:38 +00:00
|
|
|
|
{
|
2011-11-13 20:51:15 +00:00
|
|
|
|
var newznab = new NewznabDefinition
|
|
|
|
|
{
|
|
|
|
|
Enable = false,
|
|
|
|
|
Name = "Newznab Provider"
|
|
|
|
|
};
|
2011-02-16 04:44:19 +00:00
|
|
|
|
|
2011-11-13 20:51:15 +00:00
|
|
|
|
var id = _newznabProvider.Save(newznab);
|
|
|
|
|
newznab.Id = id;
|
|
|
|
|
|
|
|
|
|
ViewData["ProviderId"] = id;
|
|
|
|
|
|
2011-11-15 23:11:17 +00:00
|
|
|
|
return PartialView("NewznabProvider", newznab);
|
2011-02-12 06:10:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-13 20:51:15 +00:00
|
|
|
|
public ActionResult GetNewznabProviderView(NewznabDefinition provider)
|
|
|
|
|
{
|
|
|
|
|
ViewData["ProviderId"] = provider.Id;
|
|
|
|
|
|
|
|
|
|
return PartialView("NewznabProvider", provider);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonResult DeleteNewznabProvider(int providerId)
|
2011-04-22 00:30:19 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2011-11-13 20:51:15 +00:00
|
|
|
|
_newznabProvider.Delete(providerId);
|
2011-04-22 00:30:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
|
}
|
2011-04-22 17:09:06 +00:00
|
|
|
|
|
2011-04-22 00:30:19 +00:00
|
|
|
|
return new JsonResult { Data = "ok" };
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-13 20:51:15 +00:00
|
|
|
|
public ActionResult SubMenu()
|
|
|
|
|
{
|
|
|
|
|
return PartialView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QualityModel GetUpdatedProfileList()
|
|
|
|
|
{
|
|
|
|
|
var profiles = _qualityProvider.All().ToList();
|
|
|
|
|
var defaultQualityQualityProfileId =
|
|
|
|
|
Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId));
|
|
|
|
|
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
|
|
|
|
|
|
|
|
|
return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, QualityProfileSelectList = selectList };
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-11 06:46:26 +00:00
|
|
|
|
public JsonResult AutoConfigureSab()
|
2011-04-25 07:42:29 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2011-05-11 06:46:26 +00:00
|
|
|
|
var info = _autoConfigureProvider.AutoConfigureSab();
|
|
|
|
|
return Json(info, JsonRequestBehavior.AllowGet);
|
2011-04-25 07:42:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return new JsonResult { Data = "failed" };
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-08 21:50:48 +00:00
|
|
|
|
|
2010-09-24 05:21:45 +00:00
|
|
|
|
[HttpPost]
|
2011-08-08 21:50:48 +00:00
|
|
|
|
public JsonResult SaveIndexers(IndexerSettingsModel data)
|
2010-09-24 05:21:45 +00:00
|
|
|
|
{
|
2011-02-15 01:20:17 +00:00
|
|
|
|
if (ModelState.IsValid)
|
2010-09-24 05:21:45 +00:00
|
|
|
|
{
|
2011-05-20 04:21:18 +00:00
|
|
|
|
var nzbsOrgSettings = _indexerProvider.GetSettings(typeof(NzbsOrg));
|
2011-04-19 23:46:21 +00:00
|
|
|
|
nzbsOrgSettings.Enable = data.NzbsOrgEnabled;
|
|
|
|
|
_indexerProvider.SaveSettings(nzbsOrgSettings);
|
2011-01-29 06:10:22 +00:00
|
|
|
|
|
2011-05-20 04:21:18 +00:00
|
|
|
|
var nzbMatrixSettings = _indexerProvider.GetSettings(typeof(NzbMatrix));
|
2011-04-19 23:46:21 +00:00
|
|
|
|
nzbMatrixSettings.Enable = data.NzbMatrixEnabled;
|
|
|
|
|
_indexerProvider.SaveSettings(nzbMatrixSettings);
|
|
|
|
|
|
2011-05-20 04:21:18 +00:00
|
|
|
|
var nzbsRUsSettings = _indexerProvider.GetSettings(typeof(NzbsRUs));
|
2011-04-19 23:46:21 +00:00
|
|
|
|
nzbsRUsSettings.Enable = data.NzbsRUsEnabled;
|
|
|
|
|
_indexerProvider.SaveSettings(nzbsRUsSettings);
|
|
|
|
|
|
2011-05-20 04:21:18 +00:00
|
|
|
|
var newzbinSettings = _indexerProvider.GetSettings(typeof(Newzbin));
|
2011-04-19 23:46:21 +00:00
|
|
|
|
newzbinSettings.Enable = data.NewzbinEnabled;
|
|
|
|
|
_indexerProvider.SaveSettings(newzbinSettings);
|
2011-01-31 01:30:59 +00:00
|
|
|
|
|
2011-11-16 00:45:22 +00:00
|
|
|
|
var newznabSettings = _indexerProvider.GetSettings(typeof(Newznab));
|
|
|
|
|
newznabSettings.Enable = data.NewznabEnabled;
|
|
|
|
|
_indexerProvider.SaveSettings(newznabSettings);
|
|
|
|
|
|
2011-04-19 00:12:06 +00:00
|
|
|
|
_configProvider.NzbsOrgUId = data.NzbsOrgUId;
|
2011-04-22 17:09:06 +00:00
|
|
|
|
_configProvider.NzbsOrgHash = data.NzbsOrgHash;
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-04-19 23:46:21 +00:00
|
|
|
|
_configProvider.NzbMatrixUsername = data.NzbMatrixUsername;
|
|
|
|
|
_configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey;
|
|
|
|
|
|
|
|
|
|
_configProvider.NzbsrusUId = data.NzbsrusUId;
|
2011-04-22 17:09:06 +00:00
|
|
|
|
_configProvider.NzbsrusHash = data.NzbsrusHash;
|
2011-04-19 23:46:21 +00:00
|
|
|
|
|
|
|
|
|
_configProvider.NewzbinUsername = data.NewzbinUsername;
|
|
|
|
|
_configProvider.NewzbinPassword = data.NewzbinPassword;
|
2011-04-19 00:12:06 +00:00
|
|
|
|
|
2011-11-13 20:51:15 +00:00
|
|
|
|
if (data.NewznabDefinitions != null)
|
|
|
|
|
_newznabProvider.SaveAll(data.NewznabDefinitions);
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetSuccessResult();
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetInvalidModelResult();
|
2010-09-23 03:19:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-29 06:10:22 +00:00
|
|
|
|
[HttpPost]
|
2011-08-08 21:50:48 +00:00
|
|
|
|
public JsonResult SaveSabnzbd(SabnzbdSettingsModel data)
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
2011-02-11 01:22:29 +00:00
|
|
|
|
if (ModelState.IsValid)
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
2011-09-23 00:18:41 +00:00
|
|
|
|
//Check to see if the TV Directory matches any RootDirs (Ignoring Case), if it does, return an error to the user
|
|
|
|
|
//This prevents a user from finding a way to delete their entire TV Library
|
|
|
|
|
var rootDirs = _rootDirProvider.GetAll();
|
|
|
|
|
if (rootDirs.Any(r => r.Path.Equals(data.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase)))
|
|
|
|
|
Json(new NotificationResult { Title = "Failed", Text = "Invalid TV Directory", NotificationType = NotificationType.Error });
|
|
|
|
|
|
2011-03-31 01:42:27 +00:00
|
|
|
|
_configProvider.SabHost = data.SabHost;
|
2011-05-16 07:32:01 +00:00
|
|
|
|
_configProvider.SabPort = data.SabPort;
|
2011-03-31 01:42:27 +00:00
|
|
|
|
_configProvider.SabApiKey = data.SabApiKey;
|
|
|
|
|
_configProvider.SabPassword = data.SabPassword;
|
|
|
|
|
_configProvider.SabTvCategory = data.SabTvCategory;
|
|
|
|
|
_configProvider.SabUsername = data.SabUsername;
|
2011-05-16 07:32:01 +00:00
|
|
|
|
_configProvider.SabTvPriority = data.SabTvPriority;
|
2011-06-07 07:08:37 +00:00
|
|
|
|
_configProvider.SabDropDirectory = data.SabDropDirectory;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
|
|
|
|
|
return GetSuccessResult();
|
2011-02-11 01:22:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return
|
|
|
|
|
Json(new NotificationResult() { Title = "Failed", Text = "Invalid request data.", NotificationType = NotificationType.Error });
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-04 02:58:02 +00:00
|
|
|
|
[HttpPost]
|
2011-08-22 01:00:12 +00:00
|
|
|
|
public JsonResult SaveQuality(QualityModel data)
|
2011-02-04 02:58:02 +00:00
|
|
|
|
{
|
2011-02-15 01:20:17 +00:00
|
|
|
|
if (ModelState.IsValid)
|
2011-02-04 02:58:02 +00:00
|
|
|
|
{
|
2011-05-18 03:39:26 +00:00
|
|
|
|
_configProvider.DefaultQualityProfile = data.DefaultQualityProfileId;
|
2011-02-15 01:20:17 +00:00
|
|
|
|
|
|
|
|
|
//Saves only the Default Quality, skips User Profiles since none exist
|
2011-05-29 04:07:11 +00:00
|
|
|
|
if (data.Profiles == null)
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetSuccessResult();
|
2011-02-15 01:20:17 +00:00
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
|
foreach (var profile in data.Profiles)
|
2011-02-15 01:20:17 +00:00
|
|
|
|
{
|
2011-05-29 04:07:11 +00:00
|
|
|
|
Logger.Debug(String.Format("Updating Profile: {0}", profile));
|
2011-02-06 07:13:17 +00:00
|
|
|
|
|
2011-02-15 01:20:17 +00:00
|
|
|
|
profile.Allowed = new List<QualityTypes>();
|
2011-05-29 08:59:25 +00:00
|
|
|
|
|
2011-05-29 21:25:00 +00:00
|
|
|
|
//Remove the extra comma from the end
|
|
|
|
|
profile.AllowedString = profile.AllowedString.Trim(',');
|
2011-05-29 08:59:25 +00:00
|
|
|
|
|
2011-02-15 01:20:17 +00:00
|
|
|
|
foreach (var quality in profile.AllowedString.Split(','))
|
2011-02-15 00:45:31 +00:00
|
|
|
|
{
|
2011-04-19 00:12:06 +00:00
|
|
|
|
var qType = (QualityTypes)Enum.Parse(typeof(QualityTypes), quality);
|
2011-02-15 01:20:17 +00:00
|
|
|
|
profile.Allowed.Add(qType);
|
|
|
|
|
}
|
2011-02-15 00:45:31 +00:00
|
|
|
|
|
2011-02-15 01:20:17 +00:00
|
|
|
|
//If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit
|
|
|
|
|
if (!profile.Allowed.Contains(profile.Cutoff))
|
2011-08-22 01:00:12 +00:00
|
|
|
|
return GetInvalidModelResult();
|
2011-02-15 01:20:17 +00:00
|
|
|
|
//profile.Cutoff = profile.Allowed.Last();
|
2011-02-06 07:13:17 +00:00
|
|
|
|
|
2011-04-22 17:09:06 +00:00
|
|
|
|
_qualityProvider.Update(profile);
|
2011-02-06 07:13:17 +00:00
|
|
|
|
}
|
2011-08-05 04:38:18 +00:00
|
|
|
|
|
2011-09-16 04:42:30 +00:00
|
|
|
|
var qualityTypesFromDb = _qualityTypeProvider.All();
|
|
|
|
|
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 1).MaxSize = data.SdtvMaxSize;
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 2).MaxSize = data.DvdMaxSize;
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 4).MaxSize = data.HdtvMaxSize;
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 5).MaxSize = data.WebdlMaxSize;
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 6).MaxSize = data.Bluray720pMaxSize;
|
|
|
|
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 7).MaxSize = data.Bluray1080pMaxSize;
|
|
|
|
|
|
|
|
|
|
_qualityTypeProvider.UpdateAll(qualityTypesFromDb);
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetSuccessResult();
|
2011-02-04 02:58:02 +00:00
|
|
|
|
}
|
2011-02-05 06:07:25 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetInvalidModelResult();
|
2011-02-11 01:22:29 +00:00
|
|
|
|
}
|
2011-02-26 04:07:22 +00:00
|
|
|
|
|
2011-03-07 07:32:36 +00:00
|
|
|
|
[HttpPost]
|
2011-08-22 01:00:12 +00:00
|
|
|
|
public JsonResult SaveNotifications(NotificationSettingsModel data)
|
2011-03-07 07:32:36 +00:00
|
|
|
|
{
|
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
|
{
|
2011-07-28 07:21:49 +00:00
|
|
|
|
//XBMC Enabled
|
|
|
|
|
var xbmcSettings = _externalNotificationProvider.GetSettings(typeof(Xbmc));
|
|
|
|
|
xbmcSettings.Enable = data.XbmcEnabled;
|
|
|
|
|
_externalNotificationProvider.SaveSettings(xbmcSettings);
|
|
|
|
|
|
2011-07-09 18:19:33 +00:00
|
|
|
|
_configProvider.XbmcNotifyOnGrab = data.XbmcNotifyOnGrab;
|
|
|
|
|
_configProvider.XbmcNotifyOnDownload = data.XbmcNotifyOnDownload;
|
|
|
|
|
_configProvider.XbmcUpdateLibrary = data.XbmcUpdateLibrary;
|
|
|
|
|
_configProvider.XbmcCleanLibrary = data.XbmcCleanLibrary;
|
|
|
|
|
_configProvider.XbmcHosts = data.XbmcHosts;
|
|
|
|
|
_configProvider.XbmcUsername = data.XbmcUsername;
|
|
|
|
|
_configProvider.XbmcPassword = data.XbmcPassword;
|
2011-03-07 07:32:36 +00:00
|
|
|
|
|
2011-10-27 05:46:54 +00:00
|
|
|
|
//SMTP
|
|
|
|
|
var smtpSettings = _externalNotificationProvider.GetSettings(typeof (Smtp));
|
|
|
|
|
smtpSettings.Enable = data.SmtpEnabled;
|
|
|
|
|
_externalNotificationProvider.SaveSettings(smtpSettings);
|
|
|
|
|
|
|
|
|
|
_configProvider.SmtpNotifyOnGrab = data.SmtpNotifyOnGrab;
|
2011-10-28 08:14:13 +00:00
|
|
|
|
_configProvider.SmtpNotifyOnDownload = data.SmtpNotifyOnDownload;
|
2011-10-27 05:46:54 +00:00
|
|
|
|
_configProvider.SmtpServer = data.SmtpServer;
|
|
|
|
|
_configProvider.SmtpPort = data.SmtpPort;
|
|
|
|
|
_configProvider.SmtpUseSsl = data.SmtpUseSsl;
|
|
|
|
|
_configProvider.SmtpUsername = data.SmtpUsername;
|
|
|
|
|
_configProvider.SmtpPassword = data.SmtpPassword;
|
|
|
|
|
_configProvider.SmtpFromAddress = data.SmtpFromAddress;
|
|
|
|
|
_configProvider.SmtpToAddresses = data.SmtpToAddresses;
|
|
|
|
|
|
2011-10-28 08:14:13 +00:00
|
|
|
|
//Twitter
|
|
|
|
|
var twitterSettings = _externalNotificationProvider.GetSettings(typeof(Twitter));
|
|
|
|
|
twitterSettings.Enable = data.TwitterEnabled;
|
|
|
|
|
_externalNotificationProvider.SaveSettings(twitterSettings);
|
|
|
|
|
|
|
|
|
|
_configProvider.TwitterNotifyOnGrab = data.TwitterNotifyOnGrab;
|
|
|
|
|
_configProvider.TwitterNotifyOnDownload = data.TwitterNotifyOnDownload;
|
|
|
|
|
|
2011-11-02 07:09:52 +00:00
|
|
|
|
//Growl
|
|
|
|
|
var growlSettings = _externalNotificationProvider.GetSettings(typeof(Growl));
|
|
|
|
|
growlSettings.Enable = data.GrowlEnabled;
|
|
|
|
|
_externalNotificationProvider.SaveSettings(growlSettings);
|
|
|
|
|
|
|
|
|
|
_configProvider.GrowlNotifyOnGrab = data.GrowlNotifyOnGrab;
|
|
|
|
|
_configProvider.GrowlNotifyOnDownload = data.GrowlNotifyOnDownload;
|
|
|
|
|
_configProvider.GrowlHost = data.GrowlHost;
|
|
|
|
|
_configProvider.GrowlPassword = data.GrowlPassword;
|
|
|
|
|
|
2011-11-03 04:01:44 +00:00
|
|
|
|
//Prowl
|
|
|
|
|
var prowlSettings = _externalNotificationProvider.GetSettings(typeof(Prowl));
|
|
|
|
|
prowlSettings.Enable = data.ProwlEnabled;
|
|
|
|
|
_externalNotificationProvider.SaveSettings(prowlSettings);
|
|
|
|
|
|
|
|
|
|
_configProvider.ProwlNotifyOnGrab = data.ProwlNotifyOnGrab;
|
|
|
|
|
_configProvider.ProwlNotifyOnDownload = data.ProwlNotifyOnDownload;
|
|
|
|
|
_configProvider.ProwlApiKeys = data.ProwlApiKeys;
|
|
|
|
|
_configProvider.ProwlPriority = data.ProwlPriority;
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetSuccessResult();
|
2011-03-07 07:32:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetInvalidModelResult();
|
2011-03-07 07:32:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-26 04:07:22 +00:00
|
|
|
|
[HttpPost]
|
2011-11-29 01:11:55 +00:00
|
|
|
|
public JsonResult SaveNaming(EpisodeNamingModel data)
|
2011-02-26 04:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
|
{
|
2011-07-08 03:36:02 +00:00
|
|
|
|
_configProvider.SortingIncludeSeriesName = data.SeriesName;
|
2011-07-08 03:57:44 +00:00
|
|
|
|
_configProvider.SortingIncludeEpisodeTitle = data.EpisodeName;
|
2011-07-08 03:36:02 +00:00
|
|
|
|
_configProvider.SortingReplaceSpaces = data.ReplaceSpaces;
|
|
|
|
|
_configProvider.SortingAppendQuality = data.AppendQuality;
|
2011-05-18 23:10:25 +00:00
|
|
|
|
_configProvider.UseSeasonFolder = data.SeasonFolders;
|
2011-07-08 03:36:02 +00:00
|
|
|
|
_configProvider.SortingSeasonFolderFormat = data.SeasonFolderFormat;
|
|
|
|
|
_configProvider.SortingSeparatorStyle = data.SeparatorStyle;
|
|
|
|
|
_configProvider.SortingNumberStyle = data.NumberStyle;
|
|
|
|
|
_configProvider.SortingMultiEpisodeStyle = data.MultiEpisodeStyle;
|
2011-02-26 04:07:22 +00:00
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetSuccessResult();
|
2011-02-26 04:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
return GetInvalidModelResult();
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-01 07:04:06 +00:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public JsonResult SaveSystem(SystemSettingsModel data)
|
|
|
|
|
{
|
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
|
{
|
|
|
|
|
_configFileProvider.Port = data.Port;
|
|
|
|
|
_configFileProvider.LaunchBrowser = data.LaunchBrowser;
|
2011-10-07 23:24:28 +00:00
|
|
|
|
_configFileProvider.AuthenticationType = data.AuthenticationType;
|
2011-10-01 07:04:06 +00:00
|
|
|
|
|
|
|
|
|
return GetSuccessResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GetInvalidModelResult();
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
|
private JsonResult GetSuccessResult()
|
|
|
|
|
{
|
|
|
|
|
return Json(new NotificationResult() { Title = "Settings Saved" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JsonResult GetInvalidModelResult()
|
|
|
|
|
{
|
|
|
|
|
return Json(new NotificationResult() { Title = "Unable to save setting", Text = "Invalid post data", NotificationType = NotificationType.Error });
|
2011-02-26 04:07:22 +00:00
|
|
|
|
}
|
2011-11-03 02:44:22 +00:00
|
|
|
|
|
|
|
|
|
private SelectList GetProwlPrioritySelectList()
|
|
|
|
|
{
|
|
|
|
|
var list = new List<ProwlPrioritySelectListModel>();
|
|
|
|
|
list.Add(new ProwlPrioritySelectListModel{ Name = "Very Low", Value = -2 });
|
|
|
|
|
list.Add(new ProwlPrioritySelectListModel { Name = "Moderate", Value = -1 });
|
|
|
|
|
list.Add(new ProwlPrioritySelectListModel { Name = "Normal", Value = 0 });
|
|
|
|
|
list.Add(new ProwlPrioritySelectListModel { Name = "High", Value = 1 });
|
|
|
|
|
list.Add(new ProwlPrioritySelectListModel { Name = "Emergency", Value = 2 });
|
|
|
|
|
|
|
|
|
|
return new SelectList(list, "Value", "Name");
|
|
|
|
|
}
|
2010-09-23 03:19:47 +00:00
|
|
|
|
}
|
2011-04-10 02:44:01 +00:00
|
|
|
|
}
|