diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-07-29 16:31:15 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-07-29 16:31:15 -0400 |
| commit | 8f75454d76c9c21018476fd278f91ae69f9268c0 (patch) | |
| tree | 34a873aaf8ffd7420ca77a6f2e052a5d3dc30c75 /MediaBrowser.Server.Implementations/LiveTv/EmbyTV | |
| parent | 1f6b5a8c7c049bea309351dd495d99ec21eb32cb (diff) | |
update image processing
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv/EmbyTV')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 2319a6c2ca..c323f8e0dc 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common; +using System.Globalization; +using MediaBrowser.Common; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; @@ -453,11 +454,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } var mediaStreamInfo = await GetChannelStream(timer.ChannelId, null, CancellationToken.None); - var duration = (timer.EndDate - DateTime.UtcNow).TotalSeconds + timer.PostPaddingSeconds; + var duration = (timer.EndDate - DateTime.UtcNow).Add(TimeSpan.FromSeconds(timer.PostPaddingSeconds)); HttpRequestOptions httpRequestOptions = new HttpRequestOptions() { - Url = mediaStreamInfo.Path + "?duration=" + duration + Url = mediaStreamInfo.Path + "?duration=" + duration.TotalSeconds.ToString(CultureInfo.InvariantCulture) }; var info = GetProgramInfoFromCache(timer.ChannelId, timer.ProgramId); @@ -516,13 +517,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV try { httpRequestOptions.BufferContent = false; - httpRequestOptions.CancellationToken = cancellationToken; + var durationToken = new CancellationTokenSource(duration); + var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; + httpRequestOptions.CancellationToken = linkedToken; _logger.Info("Writing file to path: " + recordPath); using (var response = await _httpClient.SendAsync(httpRequestOptions, "GET")) { using (var output = File.Open(recordPath, FileMode.Create, FileAccess.Write, FileShare.Read)) { - await response.Content.CopyToAsync(output, 4096, cancellationToken); + await response.Content.CopyToAsync(output, 4096, linkedToken); } } @@ -530,7 +533,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } catch (OperationCanceledException) { - recording.Status = RecordingStatus.Cancelled; + recording.Status = RecordingStatus.Completed; } catch { |
