diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 22793e652..a0bbd171f 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -418,6 +418,8 @@ namespace Emby.Server.Implementations.Dto
{
dto.Type = "Recording";
dto.CanDownload = false;
+ dto.RunTimeTicks = null;
+
if (!string.IsNullOrWhiteSpace(dto.SeriesName))
{
dto.EpisodeTitle = dto.Name;
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index 7bd8fe2bf..d03006846 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -487,69 +487,8 @@ namespace Emby.Server.Implementations.HttpServer
return result;
}
- var compress = ShouldCompressResponse(requestContext, contentType);
- var hasHeaders = await GetStaticResult(requestContext, options, compress).ConfigureAwait(false);
- AddResponseHeaders(hasHeaders, options.ResponseHeaders);
-
- return hasHeaders;
- }
-
- ///
- /// Shoulds the compress response.
- ///
- /// The request context.
- /// Type of the content.
- /// true if XXXX, false otherwise
- private bool ShouldCompressResponse(IRequest requestContext, string contentType)
- {
- // It will take some work to support compression with byte range requests
- if (!string.IsNullOrWhiteSpace(requestContext.Headers.Get("Range")))
- {
- return false;
- }
-
- // Don't compress media
- if (contentType.StartsWith("audio/", StringComparison.OrdinalIgnoreCase) || contentType.StartsWith("video/", StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
-
- // Don't compress images
- if (contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
-
- if (contentType.StartsWith("font/", StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
- if (contentType.StartsWith("application/", StringComparison.OrdinalIgnoreCase))
- {
- if (string.Equals(contentType, "application/x-javascript", StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
- if (string.Equals(contentType, "application/xml", StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
- return false;
- }
-
- return true;
- }
-
- ///
- /// The us culture
- ///
- private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
- private async Task GetStaticResult(IRequest requestContext, StaticResultOptions options, bool compress)
- {
var isHeadRequest = options.IsHeadRequest;
var factoryFn = options.ContentFactory;
- var contentType = options.ContentType;
var responseHeaders = options.ResponseHeaders;
//var requestedCompressionType = GetCompressionType(requestContext);
@@ -558,22 +497,28 @@ namespace Emby.Server.Implementations.HttpServer
if (!isHeadRequest && !string.IsNullOrWhiteSpace(options.Path))
{
- return new FileWriter(options.Path, contentType, rangeHeader, _logger, _fileSystem)
+ var hasHeaders = new FileWriter(options.Path, contentType, rangeHeader, _logger, _fileSystem)
{
OnComplete = options.OnComplete,
OnError = options.OnError,
FileShare = options.FileShare
};
+
+ AddResponseHeaders(hasHeaders, options.ResponseHeaders);
+ return hasHeaders;
}
if (!string.IsNullOrWhiteSpace(rangeHeader))
{
var stream = await factoryFn().ConfigureAwait(false);
- return new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest, _logger)
+ var hasHeaders = new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest, _logger)
{
OnComplete = options.OnComplete
};
+
+ AddResponseHeaders(hasHeaders, options.ResponseHeaders);
+ return hasHeaders;
}
else
{
@@ -588,14 +533,22 @@ namespace Emby.Server.Implementations.HttpServer
return GetHttpResult(new byte[] { }, contentType, true);
}
- return new StreamWriter(stream, contentType, _logger)
+ var hasHeaders = new StreamWriter(stream, contentType, _logger)
{
OnComplete = options.OnComplete,
OnError = options.OnError
};
+
+ AddResponseHeaders(hasHeaders, options.ResponseHeaders);
+ return hasHeaders;
}
}
+ ///
+ /// The us culture
+ ///
+ private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
+
///
/// Adds the caching responseHeaders.
///
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index bc6101d6c..400169ac5 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -298,7 +298,7 @@ namespace MediaBrowser.Api
/// IEnumerable{FileSystemEntryInfo}.
private IEnumerable GetFileSystemEntries(GetDirectoryContents request)
{
- var entries = _fileSystem.GetFileSystemEntries(request.Path).Where(i =>
+ var entries = _fileSystem.GetFileSystemEntries(request.Path).OrderBy(i => i.FullName).Where(i =>
{
if (!request.IncludeHidden && i.IsHidden)
{
diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
index ae74e255b..de832314c 100644
--- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
+++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
@@ -58,12 +58,16 @@ namespace MediaBrowser.Model.Dlna
private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
{
+ ResolutionConfiguration previousOption = null;
+
foreach (var config in Configurations)
{
if (outputBitrate <= config.MaxBitrate)
{
- return config;
+ return previousOption ?? config;
}
+
+ previousOption = config;
}
return null;