Ejemplo n.º 1
0
        public void Notify(MediaBrowserSettings settings, string title, string message)
        {
            var path    = "/Notifications/Admin";
            var request = BuildRequest(path, settings);

            request.Body = new
            {
                Name        = title,
                Description = message,
                ImageUrl    = "https://raw.github.com/NzbDrone/NzbDrone/develop/Logo/64.png"
            }.ToJson();

            request.Headers.ContentType = "application/json";

            ProcessRequest(request, settings);
        }
Ejemplo n.º 2
0
        public void UpdateMovies(MediaBrowserSettings settings, string moviePath, string updateType)
        {
            var path    = "/Library/Media/Updated";
            var request = BuildRequest(path, settings);

            request.Headers.ContentType = "application/json";

            request.SetContent(new
            {
                Updates = new[]
                {
                    new
                    {
                        Path       = moviePath,
                        UpdateType = updateType
                    }
                }
            }.ToJson());

            ProcessRequest(request, settings);
        }
Ejemplo n.º 3
0
        public ValidationFailure Test(MediaBrowserSettings settings)
        {
            try
            {
                _logger.Debug("Testing connection to MediaBrowser: {0}", settings.Address);

                Notify(settings, "Test from Sonarr", "Success! MediaBrowser has been successfully configured!");
            }
            catch (RestException ex)
            {
                if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
                {
                    return(new ValidationFailure("ApiKey", "API Key is incorrect"));
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Unable to send test message: " + ex.Message);
                return(new ValidationFailure("Host", "Unable to send test message: " + ex.Message));
            }

            return(null);
        }
Ejemplo n.º 4
0
 public void Update(MediaBrowserSettings settings, Series series)
 {
     _proxy.Update(settings, series.TvdbId);
 }
Ejemplo n.º 5
0
 public void Notify(MediaBrowserSettings settings, string title, string message)
 {
     _proxy.Notify(settings, title, message);
 }
Ejemplo n.º 6
0
 public void UpdateMovies(MediaBrowserSettings settings, Movie movie)
 {
     _proxy.UpdateMovies(settings, movie.ImdbId);
 }
Ejemplo n.º 7
0
        private HttpRequest BuildRequest(string path, MediaBrowserSettings settings)
        {
            var url = string.Format(@"http://{0}/mediabrowser", settings.Address);

            return(new HttpRequestBuilder(url).Resource(path).Build());
        }
Ejemplo n.º 8
0
 public void UpdateMovies(MediaBrowserSettings settings, Movie movie, string updateType)
 {
     _proxy.UpdateMovies(settings, movie.Path, updateType);
 }