Adjust transcoding throttling

This commit is contained in:
Luke Pulverenti
2014-08-30 10:26:29 -04:00
parent 6a9dbf6ae8
commit 33c6c37316
25 changed files with 252 additions and 219 deletions

View File

@@ -38,6 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio
Tags = new List<string>();
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; }
@@ -118,6 +119,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the type of the media.
/// </summary>
/// <value>The type of the media.</value>
[IgnoreDataMember]
public override string MediaType
{
get

View File

@@ -22,6 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio
AlbumArtists = new List<string>();
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Common.Progress;
using System.Runtime.Serialization;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@@ -26,6 +27,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace MediaBrowser.Controller.Entities.Audio
{
@@ -18,6 +19,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return "MusicGenre-" + Name;
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }

View File

@@ -53,6 +53,7 @@ namespace MediaBrowser.Controller.Entities
public List<ItemImageInfo> ImageInfos { get; set; }
[IgnoreDataMember]
public virtual bool SupportsAddingToPlaylist
{
get
@@ -192,6 +193,7 @@ namespace MediaBrowser.Controller.Entities
}
}
[IgnoreDataMember]
public virtual bool SupportsLocalMetadata
{
get

View File

@@ -17,6 +17,7 @@ namespace MediaBrowser.Controller.Entities
Taglines = new List<string>();
}
[IgnoreDataMember]
public override bool SupportsLocalMetadata
{
get
@@ -25,6 +26,7 @@ namespace MediaBrowser.Controller.Entities
}
}
[IgnoreDataMember]
public override string MediaType
{
get
@@ -35,6 +37,16 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public override Folder LatestItemsIndexContainer
{
get
{
return Album;
}
}
[IgnoreDataMember]
public PhotoAlbum Album
{
get
{
@@ -53,6 +65,11 @@ namespace MediaBrowser.Controller.Entities
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public double? Altitude { get; set; }
public int? IsoSpeedRating { get; set; }
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.Other);

View File

@@ -29,6 +29,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }

View File

@@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.Entities.TV
DisplaySpecialsWithSeasons = true;
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }

View File

@@ -58,6 +58,7 @@ namespace MediaBrowser.Controller.Entities
LinkedAlternateVersions = new List<LinkedChild>();
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; }
@@ -238,6 +239,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the type of the media.
/// </summary>
/// <value>The type of the media.</value>
[IgnoreDataMember]
public override string MediaType
{
get

View File

@@ -214,6 +214,7 @@
<Compile Include="Net\IRestfulService.cs" />
<Compile Include="Net\ISessionContext.cs" />
<Compile Include="Net\LoggedAttribute.cs" />
<Compile Include="Net\StaticResultOptions.cs" />
<Compile Include="News\INewsService.cs" />
<Compile Include="Notifications\INotificationManager.cs" />
<Compile Include="Notifications\INotificationService.cs" />

View File

@@ -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, FileShare fileShare = FileShare.Read);
/// <summary>
/// Gets the static file result.
/// </summary>
/// <param name="requestContext">The request context.</param>
/// <param name="options">The options.</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);
/// <summary>
/// Gets the optimized serialized result using cache.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="request">The request.</param>
/// <param name="result">The result.</param>
/// <returns>System.Object.</returns>
object GetOptimizedSerializedResultUsingCache<T>(IRequest request, T result)
where T : class;
StaticFileResultOptions options);
}
}

View File

@@ -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;
}
}
}