aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2018-12-13 14:18:25 +0100
committerBond_009 <bond.009@outlook.com>2018-12-30 22:44:38 +0100
commit0f8b3c634708ce8e7b2e2ae6fed87b6b943b5bca (patch)
tree3b2440977592f46598ee1961199ec2c0fd3455ac /Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
parentb0fd432126606d7008544ff0237beabc52109e02 (diff)
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs')
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs19
1 files changed, 7 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
index 572edb1678..ca53036a41 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
using System.Globalization;
@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
var typeName = GetType().Name;
- Logger.Info("Opening " + typeName + " Live stream from {0}", url);
+ Logger.LogInformation("Opening " + typeName + " Live stream from {0}", url);
var httpRequestOptions = new HttpRequestOptions
{
@@ -125,17 +125,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
try
{
+ Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
using (response)
+ using (var stream = response.Content)
+ using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
{
- using (var stream = response.Content)
- {
- Logger.Info("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
-
- using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
- {
- await ApplicationHost.StreamHelper.CopyToAsync(stream, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false);
- }
- }
+ await ApplicationHost.StreamHelper.CopyToAsync(stream, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false);
}
}
catch (OperationCanceledException)
@@ -143,7 +138,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.ErrorException("Error copying live stream.", ex);
+ Logger.LogError("Error copying live stream.", ex);
}
EnableStreamSharing = false;
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);