mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-26 17:40:30 +01:00
Fix exception logging
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>>();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
var currentCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token).Token;
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
|
||||
currentCancellationToken = cancellationToken;
|
||||
|
||||
read -= RtpHeaderBytes;
|
||||
|
||||
if (read > 0)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
fileStream.Write(buffer, RtpHeaderBytes, read);
|
||||
}
|
||||
|
||||
currentCancellationToken = cancellationToken;
|
||||
|
||||
read -= RtpHeaderBytes;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user