Browse Source

allow playback of items with duration of 1 second (#1618)

pull/1619/head
Jason Dove 2 years ago committed by GitHub
parent
commit
3a906816fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      ErsatzTV.Application/Images/Commands/UpdateImageFolderDuration.cs
  3. 11
      ErsatzTV.Application/Images/Commands/UpdateImageFolderDurationHandler.cs
  4. 2
      ErsatzTV.Application/Streaming/HlsSessionWorker.cs
  5. 3
      ErsatzTV/Pages/ImageBrowser.razor

1
CHANGELOG.md

@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix timestamp continuity in `HLS Segmenter` sessions - Fix timestamp continuity in `HLS Segmenter` sessions
- This should make *some* clients happier - This should make *some* clients happier
- Fix `Other Video`, `Song` and `Image` fallback metadata tags to always include parent folder (folder added to library) - Fix `Other Video`, `Song` and `Image` fallback metadata tags to always include parent folder (folder added to library)
- Allow playback of items with a duration of 1 second
### Changed ### Changed
- Log search index updates under scanner category at debug level, to indicate a potential cause for the UI being out of date - Log search index updates under scanner category at debug level, to indicate a potential cause for the UI being out of date

2
ErsatzTV.Application/Images/Commands/UpdateImageFolderDuration.cs

@ -1,3 +1,3 @@
namespace ErsatzTV.Application.Images; namespace ErsatzTV.Application.Images;
public record UpdateImageFolderDuration(int LibraryFolderId, int? ImageFolderDuration) : IRequest; public record UpdateImageFolderDuration(int LibraryFolderId, int? ImageFolderDuration) : IRequest<int?>;

11
ErsatzTV.Application/Images/Commands/UpdateImageFolderDurationHandler.cs

@ -6,12 +6,17 @@ using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Images; namespace ErsatzTV.Application.Images;
public class UpdateImageFolderDurationHandler(IDbContextFactory<TvContext> dbContextFactory) public class UpdateImageFolderDurationHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<UpdateImageFolderDuration> : IRequestHandler<UpdateImageFolderDuration, int?>
{ {
public async Task Handle(UpdateImageFolderDuration request, CancellationToken cancellationToken) public async Task<int?> Handle(UpdateImageFolderDuration request, CancellationToken cancellationToken)
{ {
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken); await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
if (request.ImageFolderDuration.IfNone(1) < 1)
{
request = request with { ImageFolderDuration = 1 };
}
// delete entry if null // delete entry if null
if (request.ImageFolderDuration is null) if (request.ImageFolderDuration is null)
{ {
@ -111,6 +116,8 @@ public class UpdateImageFolderDurationHandler(IDbContextFactory<TvContext> dbCon
queue.Enqueue(new FolderWithParentDuration(child, effectiveDuration)); queue.Enqueue(new FolderWithParentDuration(child, effectiveDuration));
} }
} }
return request.ImageFolderDuration;
} }
private sealed record FolderWithParentDuration(LibraryFolder LibraryFolder, int? ParentDuration); private sealed record FolderWithParentDuration(LibraryFolder LibraryFolder, int? ParentDuration);

2
ErsatzTV.Application/Streaming/HlsSessionWorker.cs

@ -344,7 +344,7 @@ public class HlsSessionWorker : IHlsSessionWorker
DateTimeOffset now = _state is HlsSessionState.SeekAndWorkAhead DateTimeOffset now = _state is HlsSessionState.SeekAndWorkAhead
? DateTimeOffset.Now ? DateTimeOffset.Now
: _transcodedUntil.AddSeconds(_state is HlsSessionState.SeekAndRealtime ? 0 : 1); : _transcodedUntil.AddSeconds(_state is HlsSessionState.SeekAndRealtime ? 0 : 0.5);
bool startAtZero = _state is HlsSessionState.ZeroAndWorkAhead or HlsSessionState.ZeroAndRealtime; bool startAtZero = _state is HlsSessionState.ZeroAndWorkAhead or HlsSessionState.ZeroAndRealtime;
var request = new GetPlayoutItemProcessByChannelNumber( var request = new GetPlayoutItemProcessByChannelNumber(

3
ErsatzTV/Pages/ImageBrowser.razor

@ -93,8 +93,7 @@
DialogResult result = await dialog.Result; DialogResult result = await dialog.Result;
if (!result.Canceled) if (!result.Canceled)
{ {
var duration = result.Data as int?; int? duration = await Mediator.Send(new UpdateImageFolderDuration(item.LibraryFolderId, result.Data as int?), _cts.Token);
await Mediator.Send(new UpdateImageFolderDuration(item.LibraryFolderId, duration), _cts.Token);
item.UpdateDuration(duration); item.UpdateDuration(duration);
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
} }

Loading…
Cancel
Save