Exemple #1
0
        public JsonResult SaveDownloadClient(DownloadClientSettingsModel data)
        {
            if (ModelState.IsValid)
            {
                _configProvider.SabHost                    = data.SabHost;
                _configProvider.SabPort                    = data.SabPort;
                _configProvider.SabApiKey                  = data.SabApiKey;
                _configProvider.SabPassword                = data.SabPassword;
                _configProvider.SabTvCategory              = data.SabTvCategory;
                _configProvider.SabUsername                = data.SabUsername;
                _configProvider.SabBacklogTvPriority       = data.SabBacklogTvPriority;
                _configProvider.SabRecentTvPriority        = data.SabRecentTvPriority;
                _configProvider.DownloadClientTvDirectory  = data.DownloadClientDropDirectory;
                _configProvider.BlackholeDirectory         = data.BlackholeDirectory;
                _configProvider.DownloadClient             = (DownloadClientType)data.DownloadClient;
                _configProvider.PneumaticDirectory         = data.PneumaticDirectory;
                _configProvider.DownloadClientUseSceneName = data.UseSceneName;
                _configProvider.NzbgetHost                 = data.NzbgetHost;
                _configProvider.NzbgetPort                 = data.NzbgetPort;
                _configProvider.NzbgetUsername             = data.NzbgetUsername;
                _configProvider.NzbgetPassword             = data.NzbgetPassword;
                _configProvider.NzbgetTvCategory           = data.NzbgetTvCategory;
                _configProvider.NzbgetBacklogTvPriority    = (PriorityType)data.NzbgetBacklogTvPriority;
                _configProvider.NzbgetRecentTvPriority     = (PriorityType)data.NzbgetRecentTvPriority;

                return(GetSuccessResult());
            }

            return(JsonNotificationResult.Oops("Invalid Data"));
        }
        public JsonResult RunJob(string typeName)
        {
            if (!_jobProvider.QueueJob(typeName))
            {
                return(JsonNotificationResult.Oops("Invalid Job Name"));
            }

            return(JsonNotificationResult.Info("Job Queued"));
        }
        public JsonResult TestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses)
        {
            if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses))
            {
                return(JsonNotificationResult.Info("Successful", "Test email sent."));
            }

            return(JsonNotificationResult.Oops("Couldn't send Email, please check your settings"));
        }
Exemple #4
0
        public JsonResult DeleteQualityProfile(int profileId)
        {
            if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
            {
                return(JsonNotificationResult.Oops("Profile is still in use."));
            }

            _qualityProvider.Delete(profileId);

            return(Json("ok"));
        }
        public JsonResult VerifyTwitterAuthorization(string token, string verifier)
        {
            var result = _twitterProvider.GetAndSaveAccessToken(token, verifier);

            if (!result)
            {
                JsonNotificationResult.Oops("Couldn't verify Twitter Authorization");
            }

            return(JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization."));
        }
        public JsonResult TestNzbget(string host, int port, string username, string password)
        {
            //_prowlProvider.TestNotification(apiKeys);
            var version = _nzbgetProvider.Test(host, port, username, password);

            if (String.IsNullOrWhiteSpace(version))
            {
                return(JsonNotificationResult.Oops("Failed to connect to Nzbget, please check your settings"));
            }

            return(JsonNotificationResult.Info("Success!", "Nzbget settings have been verified successfully! Version: " + version));
        }
        public JsonResult TestPlexServer(string host)
        {
            try
            {
                _plexProvider.GetSectionKeys(host);
                return(JsonNotificationResult.Info("Success!", "Successfully tested Server settings"));
            }
            catch (Exception)
            {
            }

            return(JsonNotificationResult.Oops("Failed to connect to server, please review your settings."));
        }
        public JsonResult TestPlexNotification(string hosts, string username, string password)
        {
            try
            {
                _plexProvider.TestNotification(hosts, username, password);
                return(JsonNotificationResult.Info("Success!", "Test Notification sent successfully"));
            }
            catch (Exception)
            {
            }

            return(JsonNotificationResult.Oops("Failed to send test notification, please review your settings."));
        }
        public JsonResult TestXbmcJsonApi(string hosts, string username, string password)
        {
            try
            {
                _xbmcProvider.TestJsonApi(hosts, username, password);
                return(JsonNotificationResult.Info("Success!", "Successfully tested JSON API"));
            }
            catch (Exception)
            {
            }

            return(JsonNotificationResult.Oops("Failed to test JSON API, please review your settings."));
        }
        public JsonResult TestXbmcNotification(string hosts)
        {
            try
            {
                _xbmcProvider.TestNotification(hosts);
                return(JsonNotificationResult.Info("Success!", "Test Notification sent successfully"));
            }
            catch (Exception)
            {
            }

            return(JsonNotificationResult.Oops("Failed to send test notification, please review your settings."));
        }
        public JsonResult GetTwitterAuthorization()
        {
            var result = _twitterProvider.GetAuthorization();

            if (result == null)
            {
                JsonNotificationResult.Oops("Couldn't get Twitter Authorization");
            }

            return(new JsonResult {
                Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult RegisterGrowl(string host, string password)
        {
            try
            {
                var split    = host.Split(':');
                var hostname = split[0];
                var port     = Convert.ToInt32(split[1]);

                _growlProvider.Register(hostname, port, password);
                _growlProvider.TestNotification(hostname, port, password);

                return(JsonNotificationResult.Info("Good News!", "Registered and tested growl successfully"));
            }
            catch (Exception ex)
            {
                logger.TraceException(ex.Message, ex);
                return(JsonNotificationResult.Oops("Couldn't register and test Growl"));
            }
        }
Exemple #13
0
        public JsonResult Editor(List <SeriesModel> series)
        {
            //Save edits
            if (series == null || series.Count == 0)
            {
                return(JsonNotificationResult.Oops("Invalid post data"));
            }

            _seriesProvider.UpdateFromSeriesEditor(series.Select(s => new Series
            {
                SeriesId         = s.SeriesId,
                QualityProfileId = s.QualityProfileId,
                Monitored        = s.Monitored,
                SeasonFolder     = s.SeasonFolder,
                BacklogSetting   = (BacklogSettingType)s.BacklogSetting,
                Path             = s.Path,
                CustomStartDate  = String.IsNullOrWhiteSpace(s.CustomStartDate) ? (DateTime?)null
                                                                                : DateTime.Parse(s.CustomStartDate, null, DateTimeStyles.RoundtripKind)
            }
                                                                 ).ToList());
            return(JsonNotificationResult.Info("Series Mass Edit Saved"));
        }
Exemple #14
0
 private JsonResult GetInvalidModelResult()
 {
     return(JsonNotificationResult.Oops("Invalid post data"));
 }
Exemple #15
0
        public JsonResult SaveIndexers(IndexerSettingsModel data)
        {
            if (ModelState.IsValid)
            {
                _configProvider.Retention = data.Retention;

                var nzbsRUsSettings = _indexerProvider.GetSettings(typeof(NzbsRUs));
                nzbsRUsSettings.Enable = data.NzbsRUsEnabled;
                _indexerProvider.SaveSettings(nzbsRUsSettings);

                var newznabSettings = _indexerProvider.GetSettings(typeof(Newznab));
                newznabSettings.Enable = data.NewznabEnabled;
                _indexerProvider.SaveSettings(newznabSettings);

                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);

                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);

                var omgwtfnzbsSettings = _indexerProvider.GetSettings(typeof(Omgwtfnzbs));
                omgwtfnzbsSettings.Enable = data.OmgwtfnzbsEnabled;
                _indexerProvider.SaveSettings(omgwtfnzbsSettings);

                var nzbxSettings = _indexerProvider.GetSettings(typeof(Nzbx));
                nzbxSettings.Enable = data.NzbxEnabled;
                _indexerProvider.SaveSettings(nzbxSettings);

                _configProvider.NzbsrusUId  = data.NzbsrusUId;
                _configProvider.NzbsrusHash = data.NzbsrusHash;

                _configProvider.FileSharingTalkUid    = data.FileSharingTalkUid;
                _configProvider.FileSharingTalkSecret = data.FileSharingTalkSecret;

                _configProvider.OmgwtfnzbsUsername = data.OmgwtfnzbsUsername;
                _configProvider.OmgwtfnzbsApiKey   = data.OmgwtfnzbsApiKey;

                //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);

                try
                {
                    if (data.NewznabDefinitions != null)
                    {
                        _newznabProvider.SaveAll(data.NewznabDefinitions);
                    }
                }
                catch (Exception)
                {
                    return(JsonNotificationResult.Oops("Invalid Nzbnab Indexer found, please check your settings"));
                }

                return(GetSuccessResult());
            }

            return(GetInvalidModelResult());
        }
 public void OnException(ExceptionContext filterContext)
 {
     filterContext.Result           = JsonNotificationResult.Oops(filterContext.Exception.Message);
     filterContext.ExceptionHandled = true;
     logger.FatalException(filterContext.RequestContext.HttpContext.Request.RawUrl, filterContext.Exception);
 }