private HeadphonesCapabilities FetchCapabilities(HeadphonesSettings indexerSettings) { var capabilities = new HeadphonesCapabilities(); var url = string.Format("{0}{1}?t=caps", indexerSettings.BaseUrl.TrimEnd('/'), indexerSettings.ApiPath.TrimEnd('/')); if (indexerSettings.ApiKey.IsNotNullOrWhiteSpace()) { url += "&apikey=" + indexerSettings.ApiKey; } var request = new HttpRequest(url, HttpAccept.Rss); request.AddBasicAuthentication(indexerSettings.Username, indexerSettings.Password); HttpResponse response; try { response = _httpClient.Get(request); } catch (Exception ex) { _logger.Debug(ex, "Failed to get headphones api capabilities from {0}", indexerSettings.BaseUrl); throw; } try { capabilities = ParseCapabilities(response); } catch (XmlException ex) { _logger.Debug(ex, "Failed to parse headphones api capabilities for {0}", indexerSettings.BaseUrl); ex.WithData(response); throw; } catch (Exception ex) { _logger.Error(ex, "Failed to determine headphones api capabilities for {0}, using the defaults instead till Gamearr restarts", indexerSettings.BaseUrl); } return(capabilities); }