From 9254c37d52af3d16ec9e46b3e211ecc7dc4f1617 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 12 Feb 2014 20:52:24 -0500 Subject: [PATCH] added dlna headers for images --- MediaBrowser.Api/BaseApiService.cs | 7 ++++--- MediaBrowser.Api/Images/ImageService.cs | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index bea1ed505..5fba539fe 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -77,7 +77,7 @@ namespace MediaBrowser.Api { return ToOptimizedResult(result); } - + /// /// To the cached result. /// @@ -87,12 +87,13 @@ namespace MediaBrowser.Api /// Duration of the cache. /// The factory fn. /// Type of the content. + /// The response headers. /// System.Object. /// cacheKey - protected object ToCachedResult(Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn, string contentType) + protected object ToCachedResult(Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn, string contentType, IDictionary responseHeaders = null) where T : class { - return ResultFactory.GetCachedResult(Request, cacheKey, lastDateModified, cacheDuration, factoryFn, contentType); + return ResultFactory.GetCachedResult(Request, cacheKey, lastDateModified, cacheDuration, factoryFn, contentType, responseHeaders); } /// diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 8dfecceec..daa52f5a0 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -707,6 +707,11 @@ namespace MediaBrowser.Api.Images var currentItem = item; var currentRequest = request; + var responseHeaders = new Dictionary(); + + responseHeaders.Add("transferMode.dlna.org", "Interactive"); + responseHeaders.Add("realTimeInfo.dlna.org", "DLNA.ORG_TLAG=*"); + return ToCachedResult(cacheGuid, originalFileImageDateModified, cacheDuration, () => new ImageWriter { Item = currentItem, @@ -716,7 +721,7 @@ namespace MediaBrowser.Api.Images OriginalImagePath = imageInfo.Path, ImageProcessor = _imageProcessor - }, contentType); + }, contentType, responseHeaders); } private string GetMimeType(ImageOutputFormat format, string path)