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); }
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); }
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); }
public void Update(MediaBrowserSettings settings, Series series) { _proxy.Update(settings, series.TvdbId); }
public void Notify(MediaBrowserSettings settings, string title, string message) { _proxy.Notify(settings, title, message); }
public void UpdateMovies(MediaBrowserSettings settings, Movie movie) { _proxy.UpdateMovies(settings, movie.ImdbId); }
private HttpRequest BuildRequest(string path, MediaBrowserSettings settings) { var url = string.Format(@"http://{0}/mediabrowser", settings.Address); return(new HttpRequestBuilder(url).Resource(path).Build()); }
public void UpdateMovies(MediaBrowserSettings settings, Movie movie, string updateType) { _proxy.UpdateMovies(settings, movie.Path, updateType); }