update direct stream url for improved caching

pull/702/head
Luke Pulverenti 8 years ago
parent c18b8ec608
commit 6164049919

@ -573,11 +573,9 @@ namespace MediaBrowser.Api.Images
var outputFormats = GetOutputFormats(request, imageInfo, cropwhitespace, supportedImageEnhancers);
var cacheGuid = new Guid(_imageProcessor.GetImageCacheTag(item, imageInfo, supportedImageEnhancers));
TimeSpan? cacheDuration = null;
if (!string.IsNullOrEmpty(request.Tag) && cacheGuid == new Guid(request.Tag))
if (!string.IsNullOrEmpty(request.Tag))
{
cacheDuration = TimeSpan.FromDays(365);
}

@ -1589,6 +1589,10 @@ namespace MediaBrowser.Api.Playback
videoRequest.EnableSubtitlesInManifest = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
}
}
else if (i == 29)
{
request.Tag = val;
}
}
}

@ -154,12 +154,20 @@ namespace MediaBrowser.Api.Playback.Progressive
using (state)
{
TimeSpan? cacheDuration = null;
if (!string.IsNullOrEmpty(request.Tag))
{
cacheDuration = TimeSpan.FromDays(365);
}
return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
{
ResponseHeaders = responseHeaders,
ContentType = contentType,
IsHeadRequest = isHeadRequest,
Path = state.MediaPath
Path = state.MediaPath,
CacheDuration = cacheDuration
}).ConfigureAwait(false);
}

@ -74,6 +74,7 @@ namespace MediaBrowser.Api.Playback
public string Params { get; set; }
public string PlaySessionId { get; set; }
public string LiveStreamId { get; set; }
public string Tag { get; set; }
}
public class VideoStreamRequest : StreamRequest

@ -5,9 +5,11 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities.Audio
@ -266,6 +268,11 @@ namespace MediaBrowser.Controller.Entities.Audio
Size = i.Size
};
if (info.Protocol == MediaProtocol.File)
{
info.ETag = i.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
}
if (string.IsNullOrEmpty(info.Container))
{
if (!string.IsNullOrWhiteSpace(i.Path) && locationType != LocationType.Remote && locationType != LocationType.Virtual)

@ -12,6 +12,7 @@ using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities
@ -611,6 +612,11 @@ namespace MediaBrowser.Controller.Entities
SupportsDirectStream = i.VideoType == VideoType.VideoFile
};
if (info.Protocol == MediaProtocol.File)
{
info.ETag = i.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
}
if (i.IsShortcut)
{
info.Path = i.ShortcutPath;

@ -252,6 +252,8 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty));
list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower()));
list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty));
return list;
}

@ -20,6 +20,7 @@ namespace MediaBrowser.Model.Dto
public string Name { get; set; }
public string ETag { get; set; }
public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; }
public bool SupportsTranscoding { get; set; }

Loading…
Cancel
Save