From 14f57dddcb6e99f317596e8ee6f04efd7ce292be Mon Sep 17 00:00:00 2001 From: crobibero Date: Mon, 17 Aug 2020 11:55:58 -0600 Subject: [PATCH] Remove IHttpClient from AlbumImageProvider --- .../Plugins/AudioDb/AlbumImageProvider.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AlbumImageProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AlbumImageProvider.cs index b211ed8b77..c9dac9ecd8 100644 --- a/MediaBrowser.Providers/Plugins/AudioDb/AlbumImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/AudioDb/AlbumImageProvider.cs @@ -1,9 +1,9 @@ #pragma warning disable CS1591 using System.Collections.Generic; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -17,13 +17,13 @@ namespace MediaBrowser.Providers.Plugins.AudioDb public class AudioDbAlbumImageProvider : IRemoteImageProvider, IHasOrder { private readonly IServerConfigurationManager _config; - private readonly IHttpClient _httpClient; + private readonly IHttpClientFactory _httpClientFactory; private readonly IJsonSerializer _json; - public AudioDbAlbumImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IJsonSerializer json) + public AudioDbAlbumImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IJsonSerializer json) { _config = config; - _httpClient = httpClient; + _httpClientFactory = httpClientFactory; _json = json; } @@ -94,13 +94,10 @@ namespace MediaBrowser.Providers.Plugins.AudioDb } /// - public Task GetImageResponse(string url, CancellationToken cancellationToken) + public Task GetImageResponse(string url, CancellationToken cancellationToken) { - return _httpClient.GetResponse(new HttpRequestOptions - { - CancellationToken = cancellationToken, - Url = url - }); + var httpClient = _httpClientFactory.CreateClient(); + return httpClient.GetAsync(url, cancellationToken); } ///