diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-30 10:26:29 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-30 10:26:29 -0400 |
| commit | 33c6c37316b062b9afc1a4b3c8f97b658cb62a70 (patch) | |
| tree | 9baddcb038f806e0efa903b688aaccaff85fb5d2 /MediaBrowser.Controller/Net | |
| parent | 6a9dbf6ae85b4e7abcf06f7f29ef9d8b0b890876 (diff) | |
Adjust transcoding throttling
Diffstat (limited to 'MediaBrowser.Controller/Net')
| -rw-r--r-- | MediaBrowser.Controller/Net/IHttpResultFactory.cs | 42 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Net/StaticResultOptions.cs | 42 |
2 files changed, 54 insertions, 30 deletions
diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs index f0cfbbcfae..526bf4be2e 100644 --- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs +++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs @@ -1,8 +1,8 @@ -using System; +using ServiceStack.Web; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using ServiceStack.Web; namespace MediaBrowser.Controller.Net { @@ -89,47 +89,29 @@ namespace MediaBrowser.Controller.Net bool isHeadRequest = false); /// <summary> - /// Gets the static file result. + /// Gets the static result. /// </summary> /// <param name="requestContext">The request context.</param> - /// <param name="path">The path.</param> - /// <param name="fileShare">The file share.</param> - /// <param name="responseHeaders">The response headers.</param> - /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> + /// <param name="options">The options.</param> /// <returns>System.Object.</returns> - object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false); + object GetStaticResult(IRequest requestContext, StaticResultOptions options); /// <summary> /// Gets the static file result. /// </summary> /// <param name="requestContext">The request context.</param> /// <param name="path">The path.</param> - /// <param name="contentType">Type of the content.</param> - /// <param name="cacheCuration">The cache curation.</param> /// <param name="fileShare">The file share.</param> - /// <param name="responseHeaders">The response headers.</param> - /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> - /// <param name="throttle">if set to <c>true</c> [throttle].</param> - /// <param name="throttleLimit">The throttle limit.</param> /// <returns>System.Object.</returns> - object GetStaticFileResult(IRequest requestContext, - string path, - string contentType, - TimeSpan? cacheCuration = null, - FileShare fileShare = FileShare.Read, - IDictionary<string, string> responseHeaders = null, - bool isHeadRequest = false, - bool throttle = false, - long throttleLimit = 0); - + object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read); + /// <summary> - /// Gets the optimized serialized result using cache. + /// Gets the static file result. /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="request">The request.</param> - /// <param name="result">The result.</param> + /// <param name="requestContext">The request context.</param> + /// <param name="options">The options.</param> /// <returns>System.Object.</returns> - object GetOptimizedSerializedResultUsingCache<T>(IRequest request, T result) - where T : class; + object GetStaticFileResult(IRequest requestContext, + StaticFileResultOptions options); } } diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs new file mode 100644 index 0000000000..fde08c269d --- /dev/null +++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Net +{ + public class StaticResultOptions + { + public string ContentType { get; set; } + public TimeSpan? CacheDuration { get; set; } + public DateTime? DateLastModified { get; set; } + public Guid CacheKey { get; set; } + + public Func<Task<Stream>> ContentFactory { get; set; } + + public bool IsHeadRequest { get; set; } + + public IDictionary<string, string> ResponseHeaders { get; set; } + + public bool Throttle { get; set; } + public long ThrottleLimit { get; set; } + public long MinThrottlePosition { get; set; } + + public StaticResultOptions() + { + ResponseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + } + } + + public class StaticFileResultOptions : StaticResultOptions + { + public string Path { get; set; } + + public FileShare FileShare { get; set; } + + public StaticFileResultOptions() + { + FileShare = FileShare.Read; + } + } +} |
