2010-09-23 06:19:47 +03:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Web.Mvc;
|
2011-01-29 08:10:22 +02:00
|
|
|
using NLog;
|
2011-11-13 10:27:16 +03:00
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Common.Model;
|
2011-03-03 10:50:33 +02:00
|
|
|
using NzbDrone.Core.Helpers;
|
2012-10-07 22:16:43 +03:00
|
|
|
using NzbDrone.Core.Jobs;
|
2012-01-29 00:43:44 +03:00
|
|
|
using NzbDrone.Core.Model;
|
2011-02-05 08:07:25 +02:00
|
|
|
using NzbDrone.Core.Providers;
|
2011-04-04 06:50:12 +03:00
|
|
|
using NzbDrone.Core.Providers.Core;
|
2011-07-28 10:21:49 +03:00
|
|
|
using NzbDrone.Core.Providers.ExternalNotification;
|
2011-04-19 03:12:06 +03:00
|
|
|
using NzbDrone.Core.Providers.Indexer;
|
2011-03-09 09:40:48 +02:00
|
|
|
using NzbDrone.Core.Repository;
|
2011-02-05 08:07:25 +02:00
|
|
|
using NzbDrone.Core.Repository.Quality;
|
2012-01-19 08:01:47 +03:00
|
|
|
using NzbDrone.Web.Filters;
|
2010-09-24 08:21:45 +03:00
|
|
|
using NzbDrone.Web.Models;
|
2012-10-14 03:36:16 +03:00
|
|
|
using QualityModel = NzbDrone.Web.Models.QualityModel;
|
2010-09-23 06:19:47 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
{
|
2010-10-08 06:35:04 +03:00
|
|
|
[HandleError]
|
2010-09-23 06:19:47 +03:00
|
|
|
public class SettingsController : Controller
|
|
|
|
{
|
2011-04-10 05:44:01 +03:00
|
|
|
private readonly ConfigProvider _configProvider;
|
|
|
|
private readonly IndexerProvider _indexerProvider;
|
|
|
|
private readonly QualityProvider _qualityProvider;
|
2011-04-25 10:42:29 +03:00
|
|
|
private readonly AutoConfigureProvider _autoConfigureProvider;
|
2011-05-29 07:07:11 +03:00
|
|
|
private readonly SeriesProvider _seriesProvider;
|
2011-07-28 10:21:49 +03:00
|
|
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
2011-09-16 07:42:30 +03:00
|
|
|
private readonly QualityTypeProvider _qualityTypeProvider;
|
2011-10-01 10:04:06 +03:00
|
|
|
private readonly ConfigFileProvider _configFileProvider;
|
2011-11-13 23:51:15 +03:00
|
|
|
private readonly NewznabProvider _newznabProvider;
|
2012-07-13 05:02:30 +03:00
|
|
|
private readonly MetadataProvider _metadataProvider;
|
2012-10-07 22:16:43 +03:00
|
|
|
private readonly JobProvider _jobProvider;
|
2010-09-24 08:21:45 +03:00
|
|
|
|
2012-10-15 03:50:01 +03:00
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
2011-04-10 04:34:36 +03:00
|
|
|
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
2012-07-13 05:02:30 +03:00
|
|
|
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
|
|
|
|
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
|
|
|
|
QualityTypeProvider qualityTypeProvider, ConfigFileProvider configFileProvider,
|
2012-10-07 22:16:43 +03:00
|
|
|
NewznabProvider newznabProvider, MetadataProvider metadataProvider,
|
|
|
|
JobProvider jobProvider)
|
2010-09-24 08:21:45 +03:00
|
|
|
{
|
2011-07-28 10:21:49 +03:00
|
|
|
_externalNotificationProvider = externalNotificationProvider;
|
2011-09-16 07:42:30 +03:00
|
|
|
_qualityTypeProvider = qualityTypeProvider;
|
2011-10-01 10:04:06 +03:00
|
|
|
_configFileProvider = configFileProvider;
|
2011-11-13 23:51:15 +03:00
|
|
|
_newznabProvider = newznabProvider;
|
2012-07-13 05:02:30 +03:00
|
|
|
_metadataProvider = metadataProvider;
|
2012-10-07 22:16:43 +03:00
|
|
|
_jobProvider = jobProvider;
|
2010-09-28 07:25:41 +03:00
|
|
|
_configProvider = configProvider;
|
2011-01-29 08:10:22 +02:00
|
|
|
_indexerProvider = indexerProvider;
|
2011-02-03 04:49:52 +02:00
|
|
|
_qualityProvider = qualityProvider;
|
2011-04-25 10:42:29 +03:00
|
|
|
_autoConfigureProvider = autoConfigureProvider;
|
2011-05-29 07:07:11 +03:00
|
|
|
_seriesProvider = seriesProvider;
|
2010-09-24 08:21:45 +03:00
|
|
|
}
|
2010-09-23 06:19:47 +03:00
|
|
|
|
2011-05-16 09:27:02 +03:00
|
|
|
|
2011-07-01 23:33:03 +03:00
|
|
|
public ActionResult Index()
|
2010-09-23 06:19:47 +03:00
|
|
|
{
|
2012-10-15 03:50:01 +03:00
|
|
|
return RedirectToAction("Naming", "Settings");
|
|
|
|
}
|
|
|
|
|
|
|
|
public ActionResult Naming()
|
|
|
|
{
|
|
|
|
var model = new EpisodeNamingModel();
|
|
|
|
|
|
|
|
model.SeriesName = _configProvider.SortingIncludeSeriesName;
|
|
|
|
model.EpisodeName = _configProvider.SortingIncludeEpisodeTitle;
|
|
|
|
model.ReplaceSpaces = _configProvider.SortingReplaceSpaces;
|
|
|
|
model.AppendQuality = _configProvider.SortingAppendQuality;
|
|
|
|
model.SeasonFolders = _configProvider.UseSeasonFolder;
|
|
|
|
model.SeasonFolderFormat = _configProvider.SortingSeasonFolderFormat;
|
|
|
|
model.SeparatorStyle = _configProvider.SortingSeparatorStyle;
|
|
|
|
model.NumberStyle = _configProvider.SortingNumberStyle;
|
|
|
|
model.MultiEpisodeStyle = _configProvider.SortingMultiEpisodeStyle;
|
|
|
|
model.SceneName = _configProvider.SortingUseSceneName;
|
|
|
|
|
|
|
|
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
|
|
|
|
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
|
|
|
|
model.MultiEpisodeStyles = new SelectList(EpisodeSortingHelper.GetMultiEpisodeStyles(), "Id", "Name");
|
|
|
|
|
|
|
|
//Metadata
|
|
|
|
model.MetadataXbmcEnabled = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc)).Enable;
|
|
|
|
model.MetadataUseBanners = _configProvider.MetadataUseBanners;
|
|
|
|
|
|
|
|
return View(model);
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public ActionResult Indexers()
|
|
|
|
{
|
2011-07-01 23:33:03 +03:00
|
|
|
return View(new IndexerSettingsModel
|
2011-08-09 00:50:48 +03:00
|
|
|
{
|
2012-02-17 12:32:33 +03:00
|
|
|
Retention = _configProvider.Retention,
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
NzbMatrixUsername = _configProvider.NzbMatrixUsername,
|
|
|
|
NzbMatrixApiKey = _configProvider.NzbMatrixApiKey,
|
2011-04-19 03:12:06 +03:00
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
NzbsrusUId = _configProvider.NzbsrusUId,
|
|
|
|
NzbsrusHash = _configProvider.NzbsrusHash,
|
2011-04-19 03:12:06 +03:00
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
NewzbinUsername = _configProvider.NewzbinUsername,
|
|
|
|
NewzbinPassword = _configProvider.NewzbinPassword,
|
2011-04-19 03:12:06 +03:00
|
|
|
|
2012-04-14 10:46:42 +03:00
|
|
|
FileSharingTalkUid = _configProvider.FileSharingTalkUid,
|
|
|
|
FileSharingTalkSecret = _configProvider.FileSharingTalkSecret,
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
NzbMatrixEnabled = _indexerProvider.GetSettings(typeof(NzbMatrix)).Enable,
|
|
|
|
NzbsRUsEnabled = _indexerProvider.GetSettings(typeof(NzbsRUs)).Enable,
|
2011-11-13 23:51:15 +03:00
|
|
|
NewzbinEnabled = _indexerProvider.GetSettings(typeof(Newzbin)).Enable,
|
2011-11-16 03:45:22 +03:00
|
|
|
NewznabEnabled = _indexerProvider.GetSettings(typeof(Newznab)).Enable,
|
2012-04-14 09:44:34 +03:00
|
|
|
WomblesEnabled = _indexerProvider.GetSettings(typeof(Wombles)).Enable,
|
|
|
|
FileSharingTalkEnabled = _indexerProvider.GetSettings(typeof(FileSharingTalk)).Enable,
|
2012-04-15 03:04:08 +03:00
|
|
|
NzbIndexEnabled = _indexerProvider.GetSettings(typeof(NzbIndex)).Enable,
|
|
|
|
NzbClubEnabled = _indexerProvider.GetSettings(typeof(NzbClub)).Enable,
|
2011-11-13 23:51:15 +03:00
|
|
|
|
2012-10-07 22:16:43 +03:00
|
|
|
RssSyncInterval = _configProvider.RssSyncInterval,
|
|
|
|
|
2011-11-13 23:51:15 +03:00
|
|
|
NewznabDefinitions = _newznabProvider.All(),
|
2011-08-09 00:50:48 +03:00
|
|
|
});
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2012-01-29 00:43:44 +03:00
|
|
|
public ActionResult DownloadClient()
|
2011-01-29 08:10:22 +02:00
|
|
|
{
|
2011-08-26 20:45:59 +03:00
|
|
|
var tvCategory = _configProvider.SabTvCategory;
|
|
|
|
var tvCategorySelectList = new SelectList(new[] { tvCategory });
|
2011-06-09 04:45:06 +03:00
|
|
|
|
2012-01-29 00:43:44 +03:00
|
|
|
var downloadClientTypes = new List<KeyValuePair<int, string>>();
|
|
|
|
|
|
|
|
foreach (DownloadClientType downloadClientType in Enum.GetValues(typeof(DownloadClientType)))
|
|
|
|
downloadClientTypes.Add(new KeyValuePair<int, string>((int)downloadClientType, downloadClientType.ToString()));
|
|
|
|
|
|
|
|
var model = new DownloadClientSettingsModel
|
2011-02-11 03:22:29 +02:00
|
|
|
{
|
2011-04-25 22:02:29 +03:00
|
|
|
SabHost = _configProvider.SabHost,
|
2011-08-09 00:50:48 +03:00
|
|
|
SabPort = _configProvider.SabPort,
|
2011-04-25 22:02:29 +03:00
|
|
|
SabApiKey = _configProvider.SabApiKey,
|
|
|
|
SabUsername = _configProvider.SabUsername,
|
|
|
|
SabPassword = _configProvider.SabPassword,
|
2011-11-03 05:44:22 +03:00
|
|
|
SabTvCategory = tvCategory,
|
2011-05-16 10:32:01 +03:00
|
|
|
SabTvPriority = _configProvider.SabTvPriority,
|
2012-01-29 00:43:44 +03:00
|
|
|
DownloadClientDropDirectory = _configProvider.SabDropDirectory,
|
|
|
|
SabTvCategorySelectList = tvCategorySelectList,
|
|
|
|
DownloadClient = (int)_configProvider.DownloadClient,
|
2012-01-29 02:53:14 +03:00
|
|
|
BlackholeDirectory = _configProvider.BlackholeDirectory,
|
2012-08-30 05:33:57 +03:00
|
|
|
DownloadClientSelectList = new SelectList(downloadClientTypes, "Key", "Value"),
|
|
|
|
PneumaticDirectory = _configProvider.PneumaticDirectory
|
2011-02-11 03:22:29 +02:00
|
|
|
};
|
|
|
|
|
2011-06-30 08:22:34 +03:00
|
|
|
return View(model);
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2011-02-03 04:49:52 +02:00
|
|
|
public ActionResult Quality()
|
|
|
|
{
|
2012-10-15 02:09:07 +03:00
|
|
|
var profiles = _qualityProvider.All();
|
2011-07-01 12:10:42 +03:00
|
|
|
|
2011-05-18 06:39:26 +03:00
|
|
|
var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
2011-05-29 11:59:25 +03:00
|
|
|
var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name");
|
2011-09-16 07:42:30 +03:00
|
|
|
var qualityTypesFromDb = _qualityTypeProvider.All();
|
2011-02-05 08:07:25 +02:00
|
|
|
|
|
|
|
var model = new QualityModel
|
2011-04-10 05:44:01 +03:00
|
|
|
{
|
|
|
|
DefaultQualityProfileId = defaultQualityQualityProfileId,
|
2011-09-16 07:42:30 +03: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 05:44:01 +03:00
|
|
|
};
|
2011-02-03 04:49:52 +02:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
ViewData["Profiles"] = profiles;
|
|
|
|
|
2011-06-30 08:22:34 +03:00
|
|
|
return View(model);
|
2011-02-03 04:49:52 +02:00
|
|
|
}
|
|
|
|
|
2011-03-07 09:32:36 +02:00
|
|
|
public ActionResult Notifications()
|
|
|
|
{
|
|
|
|
var model = new NotificationSettingsModel
|
2011-04-10 05:44:01 +03:00
|
|
|
{
|
2011-07-28 10:21:49 +03:00
|
|
|
XbmcEnabled = _externalNotificationProvider.GetSettings(typeof(Xbmc)).Enable,
|
2011-07-09 21:19:33 +03:00
|
|
|
XbmcNotifyOnGrab = _configProvider.XbmcNotifyOnGrab,
|
|
|
|
XbmcNotifyOnDownload = _configProvider.XbmcNotifyOnDownload,
|
|
|
|
XbmcUpdateLibrary = _configProvider.XbmcUpdateLibrary,
|
|
|
|
XbmcCleanLibrary = _configProvider.XbmcCleanLibrary,
|
|
|
|
XbmcHosts = _configProvider.XbmcHosts,
|
|
|
|
XbmcUsername = _configProvider.XbmcUsername,
|
2011-10-27 08:46:54 +03:00
|
|
|
XbmcPassword = _configProvider.XbmcPassword,
|
2012-05-07 21:36:44 +03:00
|
|
|
XbmcUpdateWhenPlaying = _configProvider.XbmcUpdateWhenPlaying,
|
2011-10-27 08:46:54 +03:00
|
|
|
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 11:14:13 +03:00
|
|
|
SmtpToAddresses = _configProvider.SmtpToAddresses,
|
|
|
|
TwitterEnabled = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable,
|
|
|
|
TwitterNotifyOnGrab = _configProvider.TwitterNotifyOnGrab,
|
2011-11-02 10:09:52 +03:00
|
|
|
TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload,
|
|
|
|
GrowlEnabled = _externalNotificationProvider.GetSettings(typeof(Growl)).Enable,
|
|
|
|
GrowlNotifyOnGrab = _configProvider.GrowlNotifyOnGrab,
|
|
|
|
GrowlNotifyOnDownload = _configProvider.GrowlNotifyOnDownload,
|
|
|
|
GrowlHost = _configProvider.GrowlHost,
|
2011-11-03 05:44:22 +03:00
|
|
|
GrowlPassword = _configProvider.GrowlPassword,
|
|
|
|
ProwlEnabled = _externalNotificationProvider.GetSettings(typeof(Prowl)).Enable,
|
|
|
|
ProwlNotifyOnGrab = _configProvider.ProwlNotifyOnGrab,
|
|
|
|
ProwlNotifyOnDownload = _configProvider.ProwlNotifyOnDownload,
|
|
|
|
ProwlApiKeys = _configProvider.ProwlApiKeys,
|
|
|
|
ProwlPriority = _configProvider.ProwlPriority,
|
2012-02-22 02:10:42 +03:00
|
|
|
ProwlPrioritySelectList = GetProwlPrioritySelectList(),
|
|
|
|
PlexEnabled = _externalNotificationProvider.GetSettings(typeof(Plex)).Enable,
|
|
|
|
PlexNotifyOnGrab = _configProvider.PlexNotifyOnGrab,
|
|
|
|
PlexNotifyOnDownload = _configProvider.PlexNotifyOnDownload,
|
|
|
|
PlexUpdateLibrary = _configProvider.PlexUpdateLibrary,
|
|
|
|
PlexServerHost = _configProvider.PlexServerHost,
|
|
|
|
PlexClientHosts = _configProvider.PlexClientHosts,
|
|
|
|
PlexUsername = _configProvider.PlexUsername,
|
|
|
|
PlexPassword = _configProvider.PlexPassword,
|
2011-04-10 05:44:01 +03:00
|
|
|
};
|
2011-03-07 09:32:36 +02:00
|
|
|
|
2011-07-01 23:33:03 +03:00
|
|
|
return View(model);
|
2011-03-07 09:32:36 +02:00
|
|
|
}
|
|
|
|
|
2011-10-01 10:04:06 +03:00
|
|
|
public ActionResult System()
|
|
|
|
{
|
2011-10-08 02:24:28 +03: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 10:04:06 +03:00
|
|
|
var model = new SystemSettingsModel();
|
|
|
|
model.Port = _configFileProvider.Port;
|
|
|
|
model.LaunchBrowser = _configFileProvider.LaunchBrowser;
|
2011-10-08 02:24:28 +03:00
|
|
|
model.AuthenticationType = selectedAuthenticationType;
|
|
|
|
model.AuthTypeSelectList = authTypeSelectList;
|
2012-09-04 10:11:27 +03:00
|
|
|
model.RecycleBin = _configProvider.RecycleBin;
|
2011-10-01 10:04:06 +03:00
|
|
|
|
|
|
|
return View(model);
|
|
|
|
}
|
|
|
|
|
2012-01-15 03:01:51 +03:00
|
|
|
public ActionResult Misc()
|
|
|
|
{
|
|
|
|
var model = new MiscSettingsModel();
|
|
|
|
model.EnableBacklogSearching = _configProvider.EnableBacklogSearching;
|
2012-02-28 09:06:02 +03:00
|
|
|
model.AutoIgnorePreviouslyDownloadedEpisodes = _configProvider.AutoIgnorePreviouslyDownloadedEpisodes;
|
2012-08-07 08:32:07 +03:00
|
|
|
model.AllowedReleaseGroups = _configProvider.AllowedReleaseGroups;
|
2012-01-15 03:01:51 +03:00
|
|
|
|
|
|
|
return View(model);
|
|
|
|
}
|
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
public PartialViewResult AddProfile()
|
2011-02-05 20:27:14 +02:00
|
|
|
{
|
2011-04-22 03:30:19 +03:00
|
|
|
var qualityProfile = new QualityProfile
|
|
|
|
{
|
|
|
|
Name = "New Profile",
|
2011-04-22 20:09:06 +03:00
|
|
|
Allowed = new List<QualityTypes> { QualityTypes.Unknown },
|
2011-07-01 12:10:42 +03:00
|
|
|
Cutoff = QualityTypes.Unknown
|
2011-04-22 03:30:19 +03:00
|
|
|
};
|
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
qualityProfile.QualityProfileId = _qualityProvider.Add(qualityProfile);
|
2011-04-22 03:30:19 +03:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
return GetQualityProfileView(qualityProfile);
|
2011-04-22 03:30:19 +03:00
|
|
|
}
|
|
|
|
|
2012-10-15 02:09:07 +03:00
|
|
|
public PartialViewResult GetQualityProfileView(QualityProfile profile)
|
2011-04-22 03:30:19 +03:00
|
|
|
{
|
2011-11-29 08:10:43 +03:00
|
|
|
var model = new QualityProfileModel();
|
|
|
|
model.QualityProfileId = profile.QualityProfileId;
|
|
|
|
model.Name = profile.Name;
|
|
|
|
model.Allowed = profile.Allowed;
|
|
|
|
model.Sdtv = profile.Allowed.Contains(QualityTypes.SDTV);
|
|
|
|
model.Dvd = profile.Allowed.Contains(QualityTypes.DVD);
|
|
|
|
model.Hdtv = profile.Allowed.Contains(QualityTypes.HDTV);
|
|
|
|
model.Webdl = profile.Allowed.Contains(QualityTypes.WEBDL);
|
|
|
|
model.Bluray720p = profile.Allowed.Contains(QualityTypes.Bluray720p);
|
|
|
|
model.Bluray1080p = profile.Allowed.Contains(QualityTypes.Bluray1080p);
|
2012-10-15 02:09:07 +03:00
|
|
|
model.Cutoff = (int)profile.Cutoff;
|
|
|
|
|
|
|
|
model.SdtvId = QualityTypes.SDTV.Id;
|
|
|
|
model.DvdId = QualityTypes.DVD.Id;
|
|
|
|
model.HdtvId = QualityTypes.HDTV.Id;
|
|
|
|
model.WebdlId = QualityTypes.WEBDL.Id;
|
|
|
|
model.Bluray720pId = QualityTypes.Bluray720p.Id;
|
|
|
|
model.Bluray1080pId = QualityTypes.Bluray1080p.Id;
|
2011-11-29 08:10:43 +03:00
|
|
|
|
|
|
|
return PartialView("QualityProfileItem", model);
|
2011-02-05 20:27:14 +02:00
|
|
|
}
|
|
|
|
|
2012-10-11 10:27:05 +03:00
|
|
|
[HttpPost]
|
2012-01-19 08:01:47 +03:00
|
|
|
[JsonErrorFilter]
|
2011-11-13 23:51:15 +03:00
|
|
|
public JsonResult DeleteQualityProfile(int profileId)
|
2011-01-29 08:10:22 +02:00
|
|
|
{
|
2012-01-19 08:01:47 +03:00
|
|
|
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
|
2012-02-24 01:31:50 +03:00
|
|
|
return JsonNotificationResult.Oops("Profile is still in use.");
|
2011-11-13 23:51:15 +03:00
|
|
|
|
2012-01-19 08:01:47 +03:00
|
|
|
_qualityProvider.Delete(profileId);
|
2011-11-13 23:51:15 +03:00
|
|
|
|
2012-10-11 10:27:05 +03:00
|
|
|
return Json("ok");
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2011-11-16 02:11:17 +03:00
|
|
|
public PartialViewResult AddNewznabProvider()
|
2011-02-12 08:10:38 +02:00
|
|
|
{
|
2011-11-13 23:51:15 +03:00
|
|
|
var newznab = new NewznabDefinition
|
|
|
|
{
|
|
|
|
Enable = false,
|
|
|
|
Name = "Newznab Provider"
|
|
|
|
};
|
2011-02-16 06:44:19 +02:00
|
|
|
|
2011-11-13 23:51:15 +03:00
|
|
|
var id = _newznabProvider.Save(newznab);
|
|
|
|
newznab.Id = id;
|
|
|
|
|
|
|
|
ViewData["ProviderId"] = id;
|
|
|
|
|
2011-11-16 02:11:17 +03:00
|
|
|
return PartialView("NewznabProvider", newznab);
|
2011-02-12 08:10:38 +02:00
|
|
|
}
|
|
|
|
|
2011-11-13 23:51:15 +03:00
|
|
|
public ActionResult GetNewznabProviderView(NewznabDefinition provider)
|
|
|
|
{
|
|
|
|
ViewData["ProviderId"] = provider.Id;
|
|
|
|
|
|
|
|
return PartialView("NewznabProvider", provider);
|
|
|
|
}
|
|
|
|
|
2012-01-19 08:01:47 +03:00
|
|
|
[JsonErrorFilter]
|
|
|
|
public EmptyResult DeleteNewznabProvider(int providerId)
|
2011-04-22 03:30:19 +03:00
|
|
|
{
|
2012-01-19 08:01:47 +03:00
|
|
|
_newznabProvider.Delete(providerId);
|
|
|
|
return new EmptyResult();
|
2011-04-22 03:30:19 +03:00
|
|
|
}
|
|
|
|
|
2011-11-13 23:51:15 +03:00
|
|
|
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 };
|
2012-01-19 08:01:47 +03:00
|
|
|
}
|
2011-11-13 23:51:15 +03:00
|
|
|
|
2011-05-11 09:46:26 +03:00
|
|
|
public JsonResult AutoConfigureSab()
|
2011-04-25 10:42:29 +03:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2011-05-11 09:46:26 +03:00
|
|
|
var info = _autoConfigureProvider.AutoConfigureSab();
|
2011-12-09 07:23:23 +03:00
|
|
|
|
|
|
|
if (info != null)
|
|
|
|
return Json(info, JsonRequestBehavior.AllowGet);
|
2011-04-25 10:42:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
{
|
|
|
|
}
|
2012-01-19 08:01:47 +03:00
|
|
|
|
|
|
|
return JsonNotificationResult.Error("Auto-Configure Failed", "Please enter your SAB Settings Manually");
|
2011-04-25 10:42:29 +03:00
|
|
|
}
|
2011-08-09 00:50:48 +03:00
|
|
|
|
2010-09-24 08:21:45 +03:00
|
|
|
[HttpPost]
|
2011-08-09 00:50:48 +03:00
|
|
|
public JsonResult SaveIndexers(IndexerSettingsModel data)
|
2010-09-24 08:21:45 +03:00
|
|
|
{
|
2011-02-15 03:20:17 +02:00
|
|
|
if (ModelState.IsValid)
|
2010-09-24 08:21:45 +03:00
|
|
|
{
|
2012-02-17 12:32:33 +03:00
|
|
|
_configProvider.Retention = data.Retention;
|
|
|
|
|
2011-05-20 07:21:18 +03:00
|
|
|
var nzbMatrixSettings = _indexerProvider.GetSettings(typeof(NzbMatrix));
|
2011-04-20 02:46:21 +03:00
|
|
|
nzbMatrixSettings.Enable = data.NzbMatrixEnabled;
|
|
|
|
_indexerProvider.SaveSettings(nzbMatrixSettings);
|
|
|
|
|
2011-05-20 07:21:18 +03:00
|
|
|
var nzbsRUsSettings = _indexerProvider.GetSettings(typeof(NzbsRUs));
|
2011-04-20 02:46:21 +03:00
|
|
|
nzbsRUsSettings.Enable = data.NzbsRUsEnabled;
|
|
|
|
_indexerProvider.SaveSettings(nzbsRUsSettings);
|
|
|
|
|
2011-05-20 07:21:18 +03:00
|
|
|
var newzbinSettings = _indexerProvider.GetSettings(typeof(Newzbin));
|
2011-04-20 02:46:21 +03:00
|
|
|
newzbinSettings.Enable = data.NewzbinEnabled;
|
|
|
|
_indexerProvider.SaveSettings(newzbinSettings);
|
2011-01-31 03:30:59 +02:00
|
|
|
|
2011-11-16 03:45:22 +03:00
|
|
|
var newznabSettings = _indexerProvider.GetSettings(typeof(Newznab));
|
|
|
|
newznabSettings.Enable = data.NewznabEnabled;
|
|
|
|
_indexerProvider.SaveSettings(newznabSettings);
|
|
|
|
|
2012-04-14 09:44:34 +03:00
|
|
|
var womblesSettings = _indexerProvider.GetSettings(typeof(Wombles));
|
|
|
|
womblesSettings.Enable = data.WomblesEnabled;
|
|
|
|
_indexerProvider.SaveSettings(womblesSettings);
|
|
|
|
|
|
|
|
var fileSharingTalkSettings = _indexerProvider.GetSettings(typeof(FileSharingTalk));
|
|
|
|
fileSharingTalkSettings.Enable = data.FileSharingTalkEnabled;
|
|
|
|
_indexerProvider.SaveSettings(fileSharingTalkSettings);
|
|
|
|
|
2012-04-15 03:04:08 +03:00
|
|
|
var nzbIndexSettings = _indexerProvider.GetSettings(typeof(NzbIndex));
|
|
|
|
nzbIndexSettings.Enable = data.NzbIndexEnabled;
|
|
|
|
_indexerProvider.SaveSettings(nzbIndexSettings);
|
|
|
|
|
|
|
|
var nzbClubSettings = _indexerProvider.GetSettings(typeof(NzbClub));
|
|
|
|
nzbClubSettings.Enable = data.NzbClubEnabled;
|
|
|
|
_indexerProvider.SaveSettings(nzbClubSettings);
|
|
|
|
|
2011-04-20 02:46:21 +03:00
|
|
|
_configProvider.NzbMatrixUsername = data.NzbMatrixUsername;
|
|
|
|
_configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey;
|
|
|
|
|
|
|
|
_configProvider.NzbsrusUId = data.NzbsrusUId;
|
2011-04-22 20:09:06 +03:00
|
|
|
_configProvider.NzbsrusHash = data.NzbsrusHash;
|
2011-04-20 02:46:21 +03:00
|
|
|
|
|
|
|
_configProvider.NewzbinUsername = data.NewzbinUsername;
|
|
|
|
_configProvider.NewzbinPassword = data.NewzbinPassword;
|
2011-04-19 03:12:06 +03:00
|
|
|
|
2012-04-14 09:44:34 +03:00
|
|
|
_configProvider.FileSharingTalkUid = data.FileSharingTalkUid;
|
|
|
|
_configProvider.FileSharingTalkSecret = data.FileSharingTalkSecret;
|
|
|
|
|
2012-10-07 22:16:43 +03:00
|
|
|
//Save the interval to config and immediately apply it the the job (to avoid a restart)
|
|
|
|
_configProvider.RssSyncInterval = data.RssSyncInterval;
|
|
|
|
|
|
|
|
var rssSyncJob = _jobProvider.GetDefinition(typeof(RssSyncJob));
|
|
|
|
rssSyncJob.Interval = data.RssSyncInterval;
|
|
|
|
_jobProvider.SaveDefinition(rssSyncJob);
|
|
|
|
|
2012-05-11 20:26:56 +03:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (data.NewznabDefinitions != null)
|
|
|
|
_newznabProvider.SaveAll(data.NewznabDefinitions);
|
|
|
|
}
|
|
|
|
catch(Exception)
|
|
|
|
{
|
|
|
|
return JsonNotificationResult.Oops("Invalid Nzbnab Indexer found, please check your settings");
|
|
|
|
}
|
2011-11-13 23:51:15 +03:00
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetSuccessResult();
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetInvalidModelResult();
|
2010-09-23 06:19:47 +03:00
|
|
|
}
|
|
|
|
|
2011-01-29 08:10:22 +02:00
|
|
|
[HttpPost]
|
2012-01-29 00:43:44 +03:00
|
|
|
public JsonResult SaveDownloadClient(DownloadClientSettingsModel data)
|
2011-01-29 08:10:22 +02:00
|
|
|
{
|
2011-02-11 03:22:29 +02:00
|
|
|
if (ModelState.IsValid)
|
2011-01-29 08:10:22 +02:00
|
|
|
{
|
2011-03-31 04:42:27 +03:00
|
|
|
_configProvider.SabHost = data.SabHost;
|
2011-05-16 10:32:01 +03:00
|
|
|
_configProvider.SabPort = data.SabPort;
|
2011-03-31 04:42:27 +03:00
|
|
|
_configProvider.SabApiKey = data.SabApiKey;
|
|
|
|
_configProvider.SabPassword = data.SabPassword;
|
|
|
|
_configProvider.SabTvCategory = data.SabTvCategory;
|
|
|
|
_configProvider.SabUsername = data.SabUsername;
|
2011-05-16 10:32:01 +03:00
|
|
|
_configProvider.SabTvPriority = data.SabTvPriority;
|
2012-01-29 00:43:44 +03:00
|
|
|
_configProvider.SabDropDirectory = data.DownloadClientDropDirectory;
|
2012-01-29 02:53:14 +03:00
|
|
|
_configProvider.BlackholeDirectory = data.BlackholeDirectory;
|
2012-01-29 00:43:44 +03:00
|
|
|
_configProvider.DownloadClient = (DownloadClientType)data.DownloadClient;
|
2012-08-30 05:33:57 +03:00
|
|
|
_configProvider.PneumaticDirectory = data.PneumaticDirectory;
|
2011-08-09 00:50:48 +03:00
|
|
|
|
|
|
|
return GetSuccessResult();
|
2011-02-11 03:22:29 +02:00
|
|
|
}
|
|
|
|
|
2012-02-24 01:31:50 +03:00
|
|
|
return JsonNotificationResult.Oops("Invalid Data");
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2011-02-04 04:58:02 +02:00
|
|
|
[HttpPost]
|
2011-08-22 04:00:12 +03:00
|
|
|
public JsonResult SaveQuality(QualityModel data)
|
2011-02-04 04:58:02 +02:00
|
|
|
{
|
2011-02-15 03:20:17 +02:00
|
|
|
if (ModelState.IsValid)
|
2011-02-04 04:58:02 +02:00
|
|
|
{
|
2011-05-18 06:39:26 +03:00
|
|
|
_configProvider.DefaultQualityProfile = data.DefaultQualityProfileId;
|
2011-02-15 03:20:17 +02:00
|
|
|
|
|
|
|
//Saves only the Default Quality, skips User Profiles since none exist
|
2011-05-29 07:07:11 +03:00
|
|
|
if (data.Profiles == null)
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetSuccessResult();
|
2011-02-15 03:20:17 +02:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
foreach (var profileModel in data.Profiles)
|
2011-02-15 03:20:17 +02:00
|
|
|
{
|
2011-11-29 08:10:43 +03:00
|
|
|
Logger.Debug(String.Format("Updating Profile: {0}", profileModel));
|
2011-02-06 09:13:17 +02:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
var profile = new QualityProfile();
|
|
|
|
profile.QualityProfileId = profileModel.QualityProfileId;
|
|
|
|
profile.Name = profileModel.Name;
|
2012-10-15 02:09:07 +03:00
|
|
|
profile.Cutoff = (QualityTypes)profileModel.Cutoff;
|
2012-01-19 08:01:47 +03:00
|
|
|
|
2011-02-15 03:20:17 +02:00
|
|
|
profile.Allowed = new List<QualityTypes>();
|
2011-05-29 11:59:25 +03:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
if (profileModel.Sdtv)
|
|
|
|
profile.Allowed.Add(QualityTypes.SDTV);
|
|
|
|
|
|
|
|
if (profileModel.Dvd)
|
|
|
|
profile.Allowed.Add(QualityTypes.DVD);
|
|
|
|
|
|
|
|
if (profileModel.Hdtv)
|
|
|
|
profile.Allowed.Add(QualityTypes.HDTV);
|
|
|
|
|
|
|
|
if (profileModel.Webdl)
|
|
|
|
profile.Allowed.Add(QualityTypes.WEBDL);
|
|
|
|
|
|
|
|
if (profileModel.Bluray720p)
|
|
|
|
profile.Allowed.Add(QualityTypes.Bluray720p);
|
2011-05-29 11:59:25 +03:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
if (profileModel.Bluray1080p)
|
|
|
|
profile.Allowed.Add(QualityTypes.Bluray1080p);
|
2011-02-15 02:45:31 +02:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
//If the Cutoff value selected is not in the allowed list then return an error
|
2011-02-15 03:20:17 +02:00
|
|
|
if (!profile.Allowed.Contains(profile.Cutoff))
|
2011-08-22 04:00:12 +03:00
|
|
|
return GetInvalidModelResult();
|
2011-02-06 09:13:17 +02:00
|
|
|
|
2011-04-22 20:09:06 +03:00
|
|
|
_qualityProvider.Update(profile);
|
2011-02-06 09:13:17 +02:00
|
|
|
}
|
2011-08-05 07:38:18 +03:00
|
|
|
|
2011-09-16 07:42:30 +03: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-09 00:50:48 +03:00
|
|
|
return GetSuccessResult();
|
2011-02-04 04:58:02 +02:00
|
|
|
}
|
2011-02-05 08:07:25 +02:00
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetInvalidModelResult();
|
2011-02-11 03:22:29 +02:00
|
|
|
}
|
2011-02-26 06:07:22 +02:00
|
|
|
|
2011-03-07 09:32:36 +02:00
|
|
|
[HttpPost]
|
2011-08-22 04:00:12 +03:00
|
|
|
public JsonResult SaveNotifications(NotificationSettingsModel data)
|
2011-03-07 09:32:36 +02:00
|
|
|
{
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
{
|
2011-07-28 10:21:49 +03:00
|
|
|
//XBMC Enabled
|
|
|
|
var xbmcSettings = _externalNotificationProvider.GetSettings(typeof(Xbmc));
|
|
|
|
xbmcSettings.Enable = data.XbmcEnabled;
|
|
|
|
_externalNotificationProvider.SaveSettings(xbmcSettings);
|
|
|
|
|
2011-07-09 21:19:33 +03: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;
|
2012-05-07 21:36:44 +03:00
|
|
|
_configProvider.XbmcUpdateWhenPlaying = data.XbmcUpdateWhenPlaying;
|
2011-03-07 09:32:36 +02:00
|
|
|
|
2011-10-27 08:46:54 +03:00
|
|
|
//SMTP
|
2012-01-19 08:01:47 +03:00
|
|
|
var smtpSettings = _externalNotificationProvider.GetSettings(typeof(Smtp));
|
2011-10-27 08:46:54 +03:00
|
|
|
smtpSettings.Enable = data.SmtpEnabled;
|
|
|
|
_externalNotificationProvider.SaveSettings(smtpSettings);
|
|
|
|
|
|
|
|
_configProvider.SmtpNotifyOnGrab = data.SmtpNotifyOnGrab;
|
2011-10-28 11:14:13 +03:00
|
|
|
_configProvider.SmtpNotifyOnDownload = data.SmtpNotifyOnDownload;
|
2011-10-27 08:46:54 +03: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 11:14:13 +03: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 10:09:52 +03: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 07:01:44 +03: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;
|
|
|
|
|
2012-02-22 02:10:42 +03:00
|
|
|
//Plex
|
|
|
|
var plexSettings = _externalNotificationProvider.GetSettings(typeof(Plex));
|
|
|
|
plexSettings.Enable = data.PlexEnabled;
|
|
|
|
_externalNotificationProvider.SaveSettings(plexSettings);
|
|
|
|
|
|
|
|
_configProvider.PlexNotifyOnGrab = data.PlexNotifyOnGrab;
|
|
|
|
_configProvider.PlexNotifyOnDownload = data.PlexNotifyOnDownload;
|
|
|
|
_configProvider.PlexUpdateLibrary = data.PlexUpdateLibrary;
|
|
|
|
_configProvider.PlexServerHost = data.PlexServerHost;
|
|
|
|
_configProvider.PlexClientHosts = data.PlexClientHosts;
|
|
|
|
_configProvider.PlexUsername = data.PlexUsername;
|
|
|
|
_configProvider.PlexPassword = data.PlexPassword;
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetSuccessResult();
|
2011-03-07 09:32:36 +02:00
|
|
|
}
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetInvalidModelResult();
|
2011-03-07 09:32:36 +02:00
|
|
|
}
|
|
|
|
|
2011-02-26 06:07:22 +02:00
|
|
|
[HttpPost]
|
2011-11-29 04:11:55 +03:00
|
|
|
public JsonResult SaveNaming(EpisodeNamingModel data)
|
2011-02-26 06:07:22 +02:00
|
|
|
{
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
{
|
2011-07-08 06:36:02 +03:00
|
|
|
_configProvider.SortingIncludeSeriesName = data.SeriesName;
|
2011-07-08 06:57:44 +03:00
|
|
|
_configProvider.SortingIncludeEpisodeTitle = data.EpisodeName;
|
2011-07-08 06:36:02 +03:00
|
|
|
_configProvider.SortingReplaceSpaces = data.ReplaceSpaces;
|
|
|
|
_configProvider.SortingAppendQuality = data.AppendQuality;
|
2011-05-19 02:10:25 +03:00
|
|
|
_configProvider.UseSeasonFolder = data.SeasonFolders;
|
2011-07-08 06:36:02 +03:00
|
|
|
_configProvider.SortingSeasonFolderFormat = data.SeasonFolderFormat;
|
|
|
|
_configProvider.SortingSeparatorStyle = data.SeparatorStyle;
|
|
|
|
_configProvider.SortingNumberStyle = data.NumberStyle;
|
|
|
|
_configProvider.SortingMultiEpisodeStyle = data.MultiEpisodeStyle;
|
2012-08-03 10:01:34 +03:00
|
|
|
_configProvider.SortingUseSceneName = data.SceneName;
|
2011-02-26 06:07:22 +02:00
|
|
|
|
2012-07-13 05:02:30 +03:00
|
|
|
//Metadata
|
|
|
|
_configProvider.MetadataUseBanners = data.MetadataUseBanners;
|
|
|
|
|
|
|
|
//Xbmc
|
|
|
|
var xbmc = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc));
|
|
|
|
xbmc.Enable = data.MetadataXbmcEnabled;
|
|
|
|
_metadataProvider.SaveSettings(xbmc);
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetSuccessResult();
|
2011-02-26 06:07:22 +02:00
|
|
|
}
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
return GetInvalidModelResult();
|
|
|
|
}
|
|
|
|
|
2011-10-01 10:04:06 +03:00
|
|
|
[HttpPost]
|
|
|
|
public JsonResult SaveSystem(SystemSettingsModel data)
|
|
|
|
{
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
{
|
|
|
|
_configFileProvider.Port = data.Port;
|
|
|
|
_configFileProvider.LaunchBrowser = data.LaunchBrowser;
|
2011-10-08 02:24:28 +03:00
|
|
|
_configFileProvider.AuthenticationType = data.AuthenticationType;
|
2012-09-04 10:11:27 +03:00
|
|
|
_configProvider.RecycleBin = data.RecycleBin;
|
2011-10-01 10:04:06 +03:00
|
|
|
|
|
|
|
return GetSuccessResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetInvalidModelResult();
|
|
|
|
}
|
|
|
|
|
2012-01-15 03:01:51 +03:00
|
|
|
[HttpPost]
|
|
|
|
public JsonResult SaveMisc(MiscSettingsModel data)
|
|
|
|
{
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
{
|
|
|
|
_configProvider.EnableBacklogSearching = data.EnableBacklogSearching;
|
2012-02-28 09:06:02 +03:00
|
|
|
_configProvider.AutoIgnorePreviouslyDownloadedEpisodes = data.AutoIgnorePreviouslyDownloadedEpisodes;
|
2012-08-07 08:32:07 +03:00
|
|
|
_configProvider.AllowedReleaseGroups = data.AllowedReleaseGroups;
|
2012-01-15 03:01:51 +03:00
|
|
|
|
|
|
|
return GetSuccessResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetInvalidModelResult();
|
|
|
|
}
|
|
|
|
|
2011-08-09 00:50:48 +03:00
|
|
|
private JsonResult GetSuccessResult()
|
|
|
|
{
|
2012-01-19 08:01:47 +03:00
|
|
|
return JsonNotificationResult.Info("Settings Saved");
|
2011-08-09 00:50:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private JsonResult GetInvalidModelResult()
|
|
|
|
{
|
2012-02-24 01:31:50 +03:00
|
|
|
return JsonNotificationResult.Oops("Invalid post data");
|
2011-02-26 06:07:22 +02:00
|
|
|
}
|
2011-11-03 05:44:22 +03:00
|
|
|
|
|
|
|
private SelectList GetProwlPrioritySelectList()
|
|
|
|
{
|
|
|
|
var list = new List<ProwlPrioritySelectListModel>();
|
2012-01-19 08:01:47 +03:00
|
|
|
list.Add(new ProwlPrioritySelectListModel { Name = "Very Low", Value = -2 });
|
2011-11-03 05:44:22 +03:00
|
|
|
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 06:19:47 +03:00
|
|
|
}
|
2011-04-10 05:44:01 +03:00
|
|
|
}
|