示例#1
0
 public void Setup()
 {
     _clientSettings = new PlexClientSettings
     {
         Host = "localhost",
         Port = 3000
     };
 }
示例#2
0
 public void Setup()
 {
     _clientSettings = new PlexClientSettings
                           {
                               Host = "localhost",
                               Port = 3000
                           };
 }
示例#3
0
 public void Notify(PlexClientSettings settings, string header, string message)
 {
     try
     {
         var command = string.Format("ExecBuiltIn(Notification({0}, {1}))", header, message);
         SendCommand(settings.Host, settings.Port, command, settings.Username, settings.Password);
     }
     catch(Exception ex)
     {
         _logger.WarnException("Failed to send notification to Plex Client: " + settings.Host, ex);
     }
 }
示例#4
0
        public ValidationFailure Test(PlexClientSettings settings)
        {
            try
            {
                _logger.Debug("Sending Test Notifcation to Plex Client: {0}", settings.Host);
                var command = string.Format("ExecBuiltIn(Notification({0}, {1}))", "Test Notification", "Success! Notifications are setup correctly");
                var result = SendCommand(settings.Host, settings.Port, command, settings.Username, settings.Password);

                if (string.IsNullOrWhiteSpace(result) ||
                    result.IndexOf("error", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    throw new Exception("Unable to connect to Plex Client");
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Unable to send test message: " + ex.Message, ex);
                return new ValidationFailure("Host", "Unable to send test message");
            }

            return null;
        }