added cancellation token to get image stream
This commit is contained in:
parent
8c64af83cd
commit
582edde742
23
MediaBrowser.Model/ApiClient/ApiClientExtensions.cs
Normal file
23
MediaBrowser.Model/ApiClient/ApiClientExtensions.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.ApiClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class ApiClientExtensions
|
||||||
|
/// </summary>
|
||||||
|
public static class ApiClientExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the image stream async.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiClient">The API client.</param>
|
||||||
|
/// <param name="url">The URL.</param>
|
||||||
|
/// <returns>Task{Stream}.</returns>
|
||||||
|
public static Task<Stream> GetImageStreamAsync(this IApiClient apiClient, string url)
|
||||||
|
{
|
||||||
|
return apiClient.GetImageStreamAsync(url, CancellationToken.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ using MediaBrowser.Model.Users;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.ApiClient
|
namespace MediaBrowser.Model.ApiClient
|
||||||
|
@ -113,9 +114,10 @@ namespace MediaBrowser.Model.ApiClient
|
||||||
/// Gets an image stream based on a url
|
/// Gets an image stream based on a url
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL.</param>
|
/// <param name="url">The URL.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{Stream}.</returns>
|
/// <returns>Task{Stream}.</returns>
|
||||||
/// <exception cref="ArgumentNullException">url</exception>
|
/// <exception cref="ArgumentNullException">url</exception>
|
||||||
Task<Stream> GetImageStreamAsync(string url);
|
Task<Stream> GetImageStreamAsync(string url, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a BaseItem
|
/// Gets a BaseItem
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ApiClient\HttpResponseEventArgs.cs" />
|
<Compile Include="ApiClient\HttpResponseEventArgs.cs" />
|
||||||
<Compile Include="ApiClient\IApiClient.cs" />
|
<Compile Include="ApiClient\IApiClient.cs" />
|
||||||
|
<Compile Include="ApiClient\ApiClientExtensions.cs" />
|
||||||
<Compile Include="Configuration\BaseApplicationConfiguration.cs" />
|
<Compile Include="Configuration\BaseApplicationConfiguration.cs" />
|
||||||
<Compile Include="Configuration\ManualLoginCategory.cs" />
|
<Compile Include="Configuration\ManualLoginCategory.cs" />
|
||||||
<Compile Include="Configuration\ServerConfiguration.cs" />
|
<Compile Include="Configuration\ServerConfiguration.cs" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user