コード例 #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);
        }
コード例 #2
0
ファイル: MediaBrowserProxy.cs プロジェクト: pablocp19/Radarr
        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);
        }
コード例 #3
0
ファイル: MediaBrowserService.cs プロジェクト: novarr/Comarr
        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);
        }
コード例 #4
0
ファイル: MediaBrowserService.cs プロジェクト: novarr/Comarr
 public void Update(MediaBrowserSettings settings, Series series)
 {
     _proxy.Update(settings, series.TvdbId);
 }
コード例 #5
0
ファイル: MediaBrowserService.cs プロジェクト: novarr/Comarr
 public void Notify(MediaBrowserSettings settings, string title, string message)
 {
     _proxy.Notify(settings, title, message);
 }
コード例 #6
0
 public void UpdateMovies(MediaBrowserSettings settings, Movie movie)
 {
     _proxy.UpdateMovies(settings, movie.ImdbId);
 }
コード例 #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());
        }
コード例 #8
0
 public void UpdateMovies(MediaBrowserSettings settings, Movie movie, string updateType)
 {
     _proxy.UpdateMovies(settings, movie.Path, updateType);
 }