mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
Add resume capability to GetTempFile
This commit is contained in:
47
MediaBrowser.Common/Net/HttpRequestOptions.cs
Normal file
47
MediaBrowser.Common/Net/HttpRequestOptions.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Common.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Class HttpRequestOptions
|
||||
/// </summary>
|
||||
public class HttpRequestOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the URL.
|
||||
/// </summary>
|
||||
/// <value>The URL.</value>
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cancellation token.
|
||||
/// </summary>
|
||||
/// <value>The cancellation token.</value>
|
||||
public CancellationToken CancellationToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the resource pool.
|
||||
/// </summary>
|
||||
/// <value>The resource pool.</value>
|
||||
public SemaphoreSlim ResourcePool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user agent.
|
||||
/// </summary>
|
||||
/// <value>The user agent.</value>
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max resume count.
|
||||
/// </summary>
|
||||
/// <value>The max resume count.</value>
|
||||
public int MaxResumeCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the progress.
|
||||
/// </summary>
|
||||
/// <value>The progress.</value>
|
||||
public IProgress<double> Progress { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -49,29 +49,15 @@ namespace MediaBrowser.Common.Net
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{Stream}.</returns>
|
||||
Task<Stream> Post(string url, Dictionary<string, string> postData, CancellationToken cancellationToken);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Downloads the contents of a given url into a temporary location
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <param name="resourcePool">The resource pool.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <param name="userAgent">The user agent.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>Task{System.String}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">progress</exception>
|
||||
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
|
||||
Task<string> GetTempFile(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken, IProgress<double> progress, string userAgent = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temp file.
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <param name="userAgent">The user agent.</param>
|
||||
/// <returns>Task{System.String}.</returns>
|
||||
Task<string> GetTempFile(string url, CancellationToken cancellationToken, IProgress<double> progress, string userAgent = null);
|
||||
Task<string> GetTempFile(HttpRequestOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Downloads the contents of a given url into a MemoryStream
|
||||
|
||||
Reference in New Issue
Block a user