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
return result; return result;
} }
_logger.LogInformation( if (distinct.Any())
"All content on channel {ChannelNumber} has the same frame rate of {FrameRate}; will not normalize", {
request.ChannelNumber, _logger.LogInformation(
distinct[0]); "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; return None;
} }

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

@ -66,7 +66,7 @@ public abstract class CallLibraryScannerHandler<TRequest>
return BaseError.New($"ErsatzTV.Scanner exited with code {process.ExitCode}"); return BaseError.New($"ErsatzTV.Scanner exited with code {process.ExitCode}");
} }
} }
catch (OperationCanceledException) catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException)
{ {
// do nothing // do nothing
} }

39
ErsatzTV.Application/Streaming/HlsSessionWorker.cs

@ -67,31 +67,38 @@ public class HlsSessionWorker : IHlsSessionWorker
DateTimeOffset filterBefore, DateTimeOffset filterBefore,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var sw = Stopwatch.StartNew();
await Slim.WaitAsync(cancellationToken);
try try
{ {
Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken); var sw = Stopwatch.StartNew();
foreach (string[] input in maybeLines) await Slim.WaitAsync(cancellationToken);
try
{ {
TrimPlaylistResult trimResult = _hlsPlaylistFilter.TrimPlaylist(PlaylistStart, filterBefore, input); Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken);
if (DateTimeOffset.Now > _lastDelete.AddSeconds(30)) foreach (string[] input in maybeLines)
{ {
DeleteOldSegments(trimResult); TrimPlaylistResult trimResult = _hlsPlaylistFilter.TrimPlaylist(PlaylistStart, filterBefore, input);
_lastDelete = DateTimeOffset.Now; 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(); // do nothing
sw.Stop();
// _logger.LogDebug("TrimPlaylist took {Duration}", sw.Elapsed);
} }
return None;
} }
public void PlayoutUpdated() public void PlayoutUpdated()

2
ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs

@ -39,7 +39,7 @@ public class EmbyApiClient : IEmbyApiClient
return await service.GetSystemInformation(apiKey, cts.Token) return await service.GetSystemInformation(apiKey, cts.Token)
.Map(response => new EmbyServerInformation(response.ServerName, response.OperatingSystem)); .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"); _logger.LogError(ex, "Timeout getting emby server name");
return BaseError.New("Emby did not respond in time"); return BaseError.New("Emby did not respond in time");

2
ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

@ -39,7 +39,7 @@ public class JellyfinApiClient : IJellyfinApiClient
return await service.GetSystemInformation(apiKey, cts.Token) return await service.GetSystemInformation(apiKey, cts.Token)
.Map(response => new JellyfinServerInformation(response.ServerName, response.OperatingSystem)); .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"); _logger.LogError(ex, "Timeout getting jellyfin server name");
return BaseError.New("Jellyfin did not respond in time"); return BaseError.New("Jellyfin did not respond in time");

2
ErsatzTV/Pages/TraktLists.razor

@ -137,7 +137,7 @@
PagedTraktListsViewModel data = await _mediator.Send(new GetPagedTraktLists(state.Page, state.PageSize), _cts.Token); PagedTraktListsViewModel data = await _mediator.Send(new GetPagedTraktLists(state.Page, state.PageSize), _cts.Token);
return new TableData<TraktListViewModel> { TotalItems = data.TotalCount, Items = data.Page }; 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> return new TableData<TraktListViewModel>
{ {

Loading…
Cancel
Save