aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2018-12-20 13:11:26 +0100
committerBond_009 <bond.009@outlook.com>2018-12-30 22:44:39 +0100
commitea4c914123ba8279b9d9fcf7d5318e11f7a3da4c (patch)
tree455bf175270ffd7c1cb8f4e4ea0fb41851f7c59e /Emby.Server.Implementations/LiveTv
parentbf01918659986cc6cbaefaebb67f607aeb1b4400 (diff)
Fix exception logging
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs52
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs24
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs34
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs9
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs16
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs8
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs84
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs2
12 files changed, 122 insertions, 123 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index b9b8802a82..ef96510bda 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -170,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error creating virtual folder", ex);
+ _logger.LogError(ex, "Error creating virtual folder");
}
pathsAdded.AddRange(pathsToCreate);
@@ -196,7 +196,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error creating recording folders", ex);
+ _logger.LogError(ex, "Error creating recording folders");
}
}
@@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error removing virtual folder", ex);
+ _logger.LogError(ex, "Error removing virtual folder");
}
}
else
@@ -236,14 +236,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error removing media path", ex);
+ _logger.LogError(ex, "Error removing media path");
}
}
}
if (requiresRefresh)
{
- _libraryManager.ValidateMediaLibrary(new SimpleProgress<Double>(), CancellationToken.None);
+ await _libraryManager.ValidateMediaLibrary(new SimpleProgress<Double>(), CancellationToken.None);
}
}
@@ -342,7 +342,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error getting channels", ex);
+ _logger.LogError(ex, "Error getting channels");
}
}
@@ -364,7 +364,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error adding metadata", ex);
+ _logger.LogError(ex, "Error adding metadata");
}
}
}
@@ -595,7 +595,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error getting channels", ex);
+ _logger.LogError(ex, "Error getting channels");
}
}
@@ -1217,7 +1217,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error recording stream", ex);
+ _logger.LogError(ex, "Error recording stream");
}
}
@@ -1414,16 +1414,16 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await recorder.Record(directStreamProvider, mediaStreamInfo, recordPath, duration, onStarted, activeRecordingInfo.CancellationTokenSource.Token).ConfigureAwait(false);
recordingStatus = RecordingStatus.Completed;
- _logger.LogInformation("Recording completed: {0}", recordPath);
+ _logger.LogInformation("Recording completed: {recordPath}", recordPath);
}
catch (OperationCanceledException)
{
- _logger.LogInformation("Recording stopped: {0}", recordPath);
+ _logger.LogInformation("Recording stopped: {recordPath}", recordPath);
recordingStatus = RecordingStatus.Completed;
}
catch (Exception ex)
{
- _logger.LogError("Error recording to {0}", ex, recordPath);
+ _logger.LogError(ex, "Error recording to {recordPath}", recordPath);
recordingStatus = RecordingStatus.Error;
}
@@ -1435,7 +1435,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error closing live stream", ex);
+ _logger.LogError(ex, "Error closing live stream");
}
}
@@ -1511,20 +1511,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error deleting 0-byte failed recording file {0}", ex, path);
+ _logger.LogError(ex, "Error deleting 0-byte failed recording file {path}", path);
}
}
}
private void TriggerRefresh(string path)
{
- _logger.LogInformation("Triggering refresh on {0}", path);
+ _logger.LogInformation("Triggering refresh on {path}", path);
var item = GetAffectedBaseItem(_fileSystem.GetDirectoryName(path));
if (item != null)
{
- _logger.LogInformation("Refreshing recording parent {0}", item.Path);
+ _logger.LogInformation("Refreshing recording parent {path}", item.Path);
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
{
@@ -1642,7 +1642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error deleting item", ex);
+ _logger.LogError(ex, "Error deleting item");
}
}
}
@@ -1668,7 +1668,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error deleting recording", ex);
+ _logger.LogError(ex, "Error deleting recording");
}
}
}
@@ -1780,7 +1780,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error running recording post processor", ex);
+ _logger.LogError(ex, "Error running recording post processor");
}
}
@@ -1794,7 +1794,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var process = (IProcess)sender;
try
{
- _logger.LogInformation("Recording post-processing script completed with exit code {0}", process.ExitCode);
+ _logger.LogInformation("Recording post-processing script completed with exit code {ExitCode}", process.ExitCode);
}
catch
{
@@ -1875,7 +1875,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error saving recording image", ex);
+ _logger.LogError(ex, "Error saving recording image");
}
}
@@ -1890,7 +1890,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error saving recording image", ex);
+ _logger.LogError(ex, "Error saving recording image");
}
}
@@ -1903,7 +1903,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error saving recording image", ex);
+ _logger.LogError(ex, "Error saving recording image");
}
}
@@ -1916,7 +1916,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error saving recording image", ex);
+ _logger.LogError(ex, "Error saving recording image");
}
}
}
@@ -1984,7 +1984,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error saving nfo", ex);
+ _logger.LogError(ex, "Error saving nfo");
}
}
@@ -2814,7 +2814,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error discovering tuner devices", ex);
+ _logger.LogError(ex, "Error discovering tuner devices");
return new List<TunerHostInfo>();
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
index af5e96c057..4ea83b7acd 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
@@ -269,14 +269,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
try
{
- _logger.LogInformation("Stopping ffmpeg recording process for {0}", _targetPath);
+ _logger.LogInformation("Stopping ffmpeg recording process for {path}", _targetPath);
//process.Kill();
_process.StandardInput.WriteLine("q");
}
catch (Exception ex)
{
- _logger.LogError("Error stopping recording transcoding job for {0}", ex, _targetPath);
+ _logger.LogError(ex, "Error stopping recording transcoding job for {path}", _targetPath);
}
if (_hasExited)
@@ -286,7 +286,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
- _logger.LogInformation("Calling recording process.WaitForExit for {0}", _targetPath);
+ _logger.LogInformation("Calling recording process.WaitForExit for {path}", _targetPath);
if (_process.WaitForExit(10000))
{
@@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error waiting for recording process to exit for {0}", ex, _targetPath);
+ _logger.LogError(ex, "Error waiting for recording process to exit for {path}", _targetPath);
}
if (_hasExited)
@@ -305,13 +305,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
- _logger.LogInformation("Killing ffmpeg recording process for {0}", _targetPath);
+ _logger.LogInformation("Killing ffmpeg recording process for {path}", _targetPath);
_process.Kill();
}
catch (Exception ex)
{
- _logger.LogError("Error killing recording transcoding job for {0}", ex, _targetPath);
+ _logger.LogError(ex, "Error killing recording transcoding job for {path}", _targetPath);
}
}
}
@@ -329,7 +329,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var exitCode = process.ExitCode;
- _logger.LogInformation("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
+ _logger.LogInformation("FFMpeg recording exited with code {ExitCode} for {path}", exitCode, _targetPath);
if (exitCode == 0)
{
@@ -337,13 +337,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
else
{
- _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed. Exit code {1}", _targetPath, exitCode)));
+ _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed. Exit code {ExitCode}", _targetPath, exitCode)));
}
}
catch
{
- _logger.LogError("FFMpeg recording exited with an error for {0}.", _targetPath);
- _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath)));
+ _logger.LogError("FFMpeg recording exited with an error for {path}.", _targetPath);
+ _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed", _targetPath)));
}
}
@@ -357,7 +357,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error disposing recording log stream", ex);
+ _logger.LogError(ex, "Error disposing recording log stream");
}
_logFileStream = null;
@@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error reading ffmpeg recording log", ex);
+ _logger.LogError(ex, "Error reading ffmpeg recording log");
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
index 813a7a5f9a..9f179dc2ce 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- Logger.LogError("Error deserializing {0}", ex, jsonFile);
+ Logger.LogError(ex, "Error deserializing {jsonFile}", jsonFile);
}
return new List<T>();
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index f00a54c7f3..5618579f6f 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.LogError("Error scheduling wake timer", ex);
+ _logger.LogError(ex, "Error scheduling wake timer");
}
}
@@ -153,12 +153,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (_timers.TryAdd(item.Id, timer))
{
- _logger.LogInformation("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
+ _logger.LogInformation("Creating recording timer for {id}, {name}. Timer will fire in {minutes} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
}
else
{
timer.Dispose();
- _logger.LogWarning("Timer already exists for item {0}", item.Id);
+ _logger.LogWarning("Timer already exists for item {id}", item.Id);
}
}
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 48b4e58339..8fb3af2113 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -527,7 +527,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
catch (Exception ex)
{
- _logger.LogError("Error getting image info from schedules direct", ex);
+ _logger.LogError(ex, "Error getting image info from schedules direct");
return new List<ScheduleDirect.ShowImages>();
}
@@ -557,35 +557,33 @@ namespace Emby.Server.Implementations.LiveTv.Listings
try
{
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false))
+ using (Stream responce = httpResponse.Content)
{
- using (Stream responce = httpResponse.Content)
- {
- var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
+ var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
- if (root != null)
+ if (root != null)
+ {
+ foreach (ScheduleDirect.Headends headend in root)
{
- foreach (ScheduleDirect.Headends headend in root)
+ foreach (ScheduleDirect.Lineup lineup in headend.lineups)
{
- foreach (ScheduleDirect.Lineup lineup in headend.lineups)
+ lineups.Add(new NameIdPair
{
- lineups.Add(new NameIdPair
- {
- Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name,
- Id = lineup.uri.Substring(18)
- });
- }
+ Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name,
+ Id = lineup.uri.Substring(18)
+ });
}
}
- else
- {
- _logger.LogInformation("No lineups available");
- }
+ }
+ else
+ {
+ _logger.LogInformation("No lineups available");
}
}
}
catch (Exception ex)
{
- _logger.LogError("Error getting headends", ex);
+ _logger.LogError(ex, "Error getting headends");
}
return lineups;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index cc8840e14a..6fe5787158 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -170,6 +170,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);
@@ -185,6 +186,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
}
@@ -212,6 +214,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
@@ -230,6 +233,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
}
@@ -260,6 +264,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);
@@ -275,6 +280,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
}
@@ -333,6 +339,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogError(ex, "Error");
}
}
}
@@ -376,7 +383,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting image info for {0}", ex, info.Name);
+ _logger.LogError(ex, "Error getting image info for {name}", info.Name);
}
return null;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 679f8668b4..ee2a9fe4b3 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1089,7 +1089,7 @@ namespace Emby.Server.Implementations.LiveTv
{
cancellationToken.ThrowIfCancellationRequested();
- _logger.LogDebug("Refreshing guide from {0}", service.Name);
+ _logger.LogDebug("Refreshing guide from {name}", service.Name);
try
{
@@ -1108,7 +1108,7 @@ namespace Emby.Server.Implementations.LiveTv
catch (Exception ex)
{
cleanDatabase = false;
- _logger.LogError("Error refreshing channels for service", ex);
+ _logger.LogError(ex, "Error refreshing channels for service");
}
numComplete++;
@@ -1171,7 +1171,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting channel information for {0}", ex, channelInfo.Item2.Name);
+ _logger.LogError(ex, "Error getting channel information for {name}", channelInfo.Item2.Name);
}
numComplete++;
@@ -1300,7 +1300,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting programs for channel {0}", ex, currentChannel.Name);
+ _logger.LogError(ex, "Error getting programs for channel {name}", currentChannel.Name);
}
numComplete++;
@@ -1645,7 +1645,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting recordings", ex);
+ _logger.LogError(ex, "Error getting recordings");
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@@ -1721,7 +1721,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting recordings", ex);
+ _logger.LogError(ex, "Error getting recordings");
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@@ -1876,7 +1876,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting recordings", ex);
+ _logger.LogError(ex, "Error getting recordings");
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});
@@ -1922,7 +1922,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.LogError("Error getting recordings", ex);
+ _logger.LogError(ex, "Error getting recordings");
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
index 97c33f1fa8..ef2010ba64 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error getting channel list", ex);
+ Logger.LogError(ex, "Error getting channel list");
if (enableCache)
{
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error getting channels", ex);
+ Logger.LogError(ex, "Error getting channels");
}
}
}
@@ -201,7 +201,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error getting channels", ex);
+ Logger.LogError(ex, "Error getting channels");
}
}
@@ -221,7 +221,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error opening tuner", ex);
+ Logger.LogError(ex, "Error opening tuner");
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index a8d1dcaa31..be090df0c9 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -303,7 +303,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
catch (Exception ex)
{
- Logger.LogError("Error getting tuner info", ex);
+ Logger.LogError(ex, "Error getting tuner info");
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
index 933c341242..c781bccbb7 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
@@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
- Logger.LogInformation("Opening HDHR UDP Live stream from {0}", uri.Host);
+ Logger.LogInformation("Opening HDHR UDP Live stream from {host}", uri.Host);
var remoteAddress = IPAddress.Parse(uri.Host);
var embyRemoteAddress = _networkManager.ParseIpAddress(uri.Host);
@@ -69,9 +69,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
localAddress = ((IPEndPoint)tcpSocket.LocalEndPoint).Address;
tcpSocket.Close();
}
- catch (Exception)
+ catch (Exception ex)
{
- Logger.LogError("Unable to determine local ip address for Legacy HDHomerun stream.");
+ Logger.LogError(ex, "Unable to determine local ip address for Legacy HDHomerun stream.");
return;
}
}
@@ -87,21 +87,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
catch (Exception ex)
{
using (udpClient)
+ using (hdHomerunManager)
{
- using (hdHomerunManager)
+ if (!(ex is OperationCanceledException))
{
- if (!(ex is OperationCanceledException))
- {
- Logger.LogError("Error opening live stream:", ex);
- }
- throw;
+ Logger.LogError(ex, "Error opening live stream:");
}
+ throw;
}
}
var taskCompletionSource = new TaskCompletionSource<bool>();
- StartStreaming(udpClient, hdHomerunManager, remoteAddress, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
+ await StartStreaming(udpClient, hdHomerunManager, remoteAddress, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
//OpenedMediaSource.Protocol = MediaProtocol.File;
//OpenedMediaSource.Path = tempFile;
@@ -122,26 +120,24 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return Task.Run(async () =>
{
using (udpClient)
+ using (hdHomerunManager)
{
- using (hdHomerunManager)
+ try
{
- try
- {
- await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
- }
- catch (OperationCanceledException ex)
- {
- Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
- openTaskCompletionSource.TrySetException(ex);
- }
- catch (Exception ex)
- {
- Logger.LogError("Error opening live stream:", ex);
- openTaskCompletionSource.TrySetException(ex);
- }
-
- EnableStreamSharing = false;
+ await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
}
+ catch (OperationCanceledException ex)
+ {
+ Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
+ openTaskCompletionSource.TrySetException(ex);
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex, "Error opening live stream:");
+ openTaskCompletionSource.TrySetException(ex);
+ }
+
+ EnableStreamSharing = false;
}
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
@@ -166,30 +162,28 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var resolved = false;
using (var source = _socketFactory.CreateNetworkStream(udpClient, false))
+ using (var fileStream = FileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
{
- using (var fileStream = FileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
- {
- var currentCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token).Token;
+ var currentCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token).Token;
- while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
- {
- cancellationToken.ThrowIfCancellationRequested();
+ while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
- currentCancellationToken = cancellationToken;
+ currentCancellationToken = cancellationToken;
- read -= RtpHeaderBytes;
+ read -= RtpHeaderBytes;
- if (read > 0)
- {
- fileStream.Write(buffer, RtpHeaderBytes, read);
- }
+ if (read > 0)
+ {
+ fileStream.Write(buffer, RtpHeaderBytes, read);
+ }
- if (!resolved)
- {
- resolved = true;
- DateOpened = DateTime.UtcNow;
- Resolve(openTaskCompletionSource);
- }
+ if (!resolved)
+ {
+ resolved = true;
+ DateOpened = DateTime.UtcNow;
+ Resolve(openTaskCompletionSource);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
index b1eda3b7f2..4a2b4ebb22 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error closing live stream", ex);
+ Logger.LogError(ex, "Error closing live stream");
}
}
@@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- //Logger.LogError("Error deleting file {0}", ex, path);
+ Logger.LogError(ex, "Error deleting file {path}", path);
failedFiles.Add(path);
}
}
@@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error seeking stream", ex);
+ Logger.LogError(ex, "Error seeking stream");
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
index ca53036a41..9b10daba0d 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
@@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.LogError("Error copying live stream.", ex);
+ Logger.LogError(ex, "Error copying live stream.");
}
EnableStreamSharing = false;
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);