Browse Source

minor bug fixes (#1225)

pull/1226/head
Jason Dove 3 years ago committed by GitHub
parent
commit
d2c4a58528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs
  2. 2
      ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs
  3. 39
      ErsatzTV.Application/Streaming/HlsSessionWorker.cs
  4. 2
      ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs
  5. 2
      ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs
  6. 2
      ErsatzTV/Pages/TraktLists.razor

18
ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs

@ -86,10 +86,20 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O @@ -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;
}

2
ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs

@ -66,7 +66,7 @@ public abstract class CallLibraryScannerHandler<TRequest> @@ -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
}

39
ErsatzTV.Application/Streaming/HlsSessionWorker.cs

@ -67,31 +67,38 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -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;
}
}
finally
{
Slim.Release();
sw.Stop();
// _logger.LogDebug("TrimPlaylist took {Duration}", sw.Elapsed);
}
return None;
}
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()

2
ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs

@ -39,7 +39,7 @@ public class EmbyApiClient : IEmbyApiClient @@ -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");

2
ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

@ -39,7 +39,7 @@ public class JellyfinApiClient : IJellyfinApiClient @@ -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");

2
ErsatzTV/Pages/TraktLists.razor

@ -137,7 +137,7 @@ @@ -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>
{

Loading…
Cancel
Save