minor bug fixes (#1225)

This commit is contained in:
Jason Dove
2023-04-01 22:51:48 -05:00
committed by GitHub
parent e93d678b97
commit d2c4a58528
6 changed files with 41 additions and 24 deletions
@@ -86,10 +86,20 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O
return result;
}
_logger.LogInformation(
"All content on channel {ChannelNumber} has the same frame rate of {FrameRate}; will not normalize",
request.ChannelNumber,
distinct[0]);
if (distinct.Any())
{
_logger.LogInformation(
"All content on channel {ChannelNumber} has the same frame rate of {FrameRate}; will not normalize",
request.ChannelNumber,
distinct[0]);
}
else
{
_logger.LogInformation(
"No content on channel {ChannelNumber} has frame rate information; will not normalize",
request.ChannelNumber);
}
return None;
}
@@ -66,7 +66,7 @@ public abstract class CallLibraryScannerHandler<TRequest>
return BaseError.New($"ErsatzTV.Scanner exited with code {process.ExitCode}");
}
}
catch (OperationCanceledException)
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
{
// do nothing
}
@@ -67,31 +67,38 @@ public class HlsSessionWorker : IHlsSessionWorker
DateTimeOffset filterBefore,
CancellationToken cancellationToken)
{
var sw = Stopwatch.StartNew();
await Slim.WaitAsync(cancellationToken);
try
{
Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken);
foreach (string[] input in maybeLines)
var sw = Stopwatch.StartNew();
await Slim.WaitAsync(cancellationToken);
try
{
TrimPlaylistResult trimResult = _hlsPlaylistFilter.TrimPlaylist(PlaylistStart, filterBefore, input);
if (DateTimeOffset.Now > _lastDelete.AddSeconds(30))
Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken);
foreach (string[] input in maybeLines)
{
DeleteOldSegments(trimResult);
_lastDelete = DateTimeOffset.Now;
TrimPlaylistResult trimResult = _hlsPlaylistFilter.TrimPlaylist(PlaylistStart, filterBefore, input);
if (DateTimeOffset.Now > _lastDelete.AddSeconds(30))
{
DeleteOldSegments(trimResult);
_lastDelete = DateTimeOffset.Now;
}
return trimResult;
}
return trimResult;
}
return None;
finally
{
Slim.Release();
sw.Stop();
// _logger.LogDebug("TrimPlaylist took {Duration}", sw.Elapsed);
}
}
finally
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
{
Slim.Release();
sw.Stop();
// _logger.LogDebug("TrimPlaylist took {Duration}", sw.Elapsed);
// do nothing
}
return None;
}
public void PlayoutUpdated()
@@ -39,7 +39,7 @@ public class EmbyApiClient : IEmbyApiClient
return await service.GetSystemInformation(apiKey, cts.Token)
.Map(response => new EmbyServerInformation(response.ServerName, response.OperatingSystem));
}
catch (OperationCanceledException ex)
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
{
_logger.LogError(ex, "Timeout getting emby server name");
return BaseError.New("Emby did not respond in time");
@@ -39,7 +39,7 @@ public class JellyfinApiClient : IJellyfinApiClient
return await service.GetSystemInformation(apiKey, cts.Token)
.Map(response => new JellyfinServerInformation(response.ServerName, response.OperatingSystem));
}
catch (OperationCanceledException ex)
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
{
_logger.LogError(ex, "Timeout getting jellyfin server name");
return BaseError.New("Jellyfin did not respond in time");
+1 -1
View File
@@ -137,7 +137,7 @@
PagedTraktListsViewModel data = await _mediator.Send(new GetPagedTraktLists(state.Page, state.PageSize), _cts.Token);
return new TableData<TraktListViewModel> { TotalItems = data.TotalCount, Items = data.Page };
}
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException or AggregateException)
{
return new TableData<TraktListViewModel>
{