From 5fe9b054c8c1c87261009f3aba997c4d594fcd6d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 13 Apr 2015 23:45:17 -0400 Subject: [PATCH] 3.0.5582.0 --- .../Playback/Hls/DynamicHlsService.cs | 2 +- MediaBrowser.Controller/Entities/BaseItem.cs | 16 +++++++++++++++- .../Encoder/MediaEncoder.cs | 14 +++----------- MediaBrowser.Model/Dto/BaseItemDto.cs | 6 ++++++ MediaBrowser.Model/Querying/ItemFields.cs | 5 +++++ .../Dto/DtoService.cs | 2 ++ SharedVersion.cs | 4 ++-- 7 files changed, 34 insertions(+), 15 deletions(-) diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index c06bbe143..1b11f1f33 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -736,7 +736,7 @@ namespace MediaBrowser.Api.Playback.Hls ).Trim(); } - return string.Format("{0} {1} -map_metadata -1 -threads {2} {3} {4} -flags -global_header -sc_threshold 0 {5} -hls_time {6} -start_number {7} -hls_list_size {8} -y \"{9}\"", + return string.Format("{0} {1} -map_metadata -1 -threads {2} {3} {4} -flags -global_header -copyts -sc_threshold 0 {5} -hls_time {6} -start_number {7} -hls_list_size {8} -y \"{9}\"", inputModifier, GetInputArgument(state), threads, diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3a43fa2ca..b7322494d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Extensions; +using System.Globalization; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Collections; @@ -1892,5 +1893,18 @@ namespace MediaBrowser.Controller.Entities return video.RefreshMetadata(newOptions, cancellationToken); } + + public string GetEtag() + { + return string.Join("|", GetEtagValues().ToArray()).GetMD5().ToString("N"); + } + + protected virtual List GetEtagValues() + { + return new List + { + DateLastSaved.Ticks.ToString(CultureInfo.InvariantCulture) + }; + } } } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 846d54a5f..df7351ad1 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -280,7 +280,7 @@ namespace MediaBrowser.MediaEncoding.Encoder private async Task> GetKeyFrames(string inputPath, int videoStreamIndex, CancellationToken cancellationToken) { - const string args = "-i {0} -select_streams v:{1} -show_frames -print_format compact"; + const string args = "-i {0} -select_streams v:{1} -show_frames -show_entries frame=pkt_dts,key_frame -print_format compact"; var process = new Process { @@ -310,15 +310,12 @@ namespace MediaBrowser.MediaEncoding.Encoder StartProcess(processWrapper); var lines = new List(); - var outputCancellationSource = new CancellationTokenSource(4000); try { process.BeginErrorReadLine(); - var linkedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(outputCancellationSource.Token, cancellationToken); - - await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, outputCancellationSource, linkedCancellationTokenSource.Token).ConfigureAwait(false); + await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, cancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { @@ -335,7 +332,7 @@ namespace MediaBrowser.MediaEncoding.Encoder return lines; } - private async Task StartReadingOutput(Stream source, List lines, int timeoutMs, CancellationTokenSource cancellationTokenSource, CancellationToken cancellationToken) + private async Task StartReadingOutput(Stream source, List lines, int timeoutMs, CancellationToken cancellationToken) { try { @@ -362,11 +359,6 @@ namespace MediaBrowser.MediaEncoding.Encoder { lines.Add(frameMs); } - - if (frameMs > timeoutMs) - { - cancellationTokenSource.Cancel(); - } } } } diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 6b223ea06..c772692a2 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -37,6 +37,12 @@ namespace MediaBrowser.Model.Dto /// The id. public string Id { get; set; } + /// + /// Gets or sets the etag. + /// + /// The etag. + public string Etag { get; set; } + /// /// Gets or sets the playlist item identifier. /// diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 54c83ca15..77b3dc0ee 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -75,6 +75,11 @@ /// DisplayMediaType, + /// + /// The etag + /// + Etag, + /// /// The external urls /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 6a7323fde..c4501564f 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -357,6 +357,8 @@ namespace MediaBrowser.Server.Implementations.Dto : item.CanDownload(user); } + + return dto; } diff --git a/SharedVersion.cs b/SharedVersion.cs index 405e1c708..c2890cb34 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.0.*")] -//[assembly: AssemblyVersion("3.0.5572.0")] +//[assembly: AssemblyVersion("3.0.*")] +[assembly: AssemblyVersion("3.0.5582.0")]