diff options
| author | crobibero <cody@robibe.ro> | 2020-08-31 12:46:42 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-08-31 12:46:42 -0600 |
| commit | 8d592777c4585058945a9a52d159346384445892 (patch) | |
| tree | ec8fc962107836b3197c275c7f69c8350b6d34bd /Emby.Server.Implementations | |
| parent | c02d0ceb57b449d6d547a8c877bf15d584717862 (diff) | |
change to using declaration
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs index b43b88abd9..377292cab8 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs @@ -70,18 +70,17 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV Directory.CreateDirectory(Path.GetDirectoryName(targetFile)); - using (var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.Read)) - { - onStarted(); + await using var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.Read); - _logger.LogInformation("Copying recording stream to file {0}", targetFile); + onStarted(); - // The media source if infinite so we need to handle stopping ourselves - var durationToken = new CancellationTokenSource(duration); - cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; + _logger.LogInformation("Copying recording stream to file {0}", targetFile); - await _streamHelper.CopyUntilCancelled(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), output, 81920, cancellationToken).ConfigureAwait(false); - } + // The media source if infinite so we need to handle stopping ourselves + var durationToken = new CancellationTokenSource(duration); + cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; + + await _streamHelper.CopyUntilCancelled(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), output, 81920, cancellationToken).ConfigureAwait(false); _logger.LogInformation("Recording completed to file {0}", targetFile); } |
