allow playback of items with duration of 1 second (#1618)
This commit is contained in:
@@ -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
|
||||
- This should make *some* clients happier
|
||||
- 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
|
||||
- Log search index updates under scanner category at debug level, to indicate a potential cause for the UI being out of date
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ErsatzTV.Application.Images;
|
||||
|
||||
public record UpdateImageFolderDuration(int LibraryFolderId, int? ImageFolderDuration) : IRequest;
|
||||
public record UpdateImageFolderDuration(int LibraryFolderId, int? ImageFolderDuration) : IRequest<int?>;
|
||||
|
||||
@@ -6,12 +6,17 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace ErsatzTV.Application.Images;
|
||||
|
||||
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);
|
||||
|
||||
if (request.ImageFolderDuration.IfNone(1) < 1)
|
||||
{
|
||||
request = request with { ImageFolderDuration = 1 };
|
||||
}
|
||||
|
||||
// delete entry if null
|
||||
if (request.ImageFolderDuration is null)
|
||||
{
|
||||
@@ -111,6 +116,8 @@ public class UpdateImageFolderDurationHandler(IDbContextFactory<TvContext> dbCon
|
||||
queue.Enqueue(new FolderWithParentDuration(child, effectiveDuration));
|
||||
}
|
||||
}
|
||||
|
||||
return request.ImageFolderDuration;
|
||||
}
|
||||
|
||||
private sealed record FolderWithParentDuration(LibraryFolder LibraryFolder, int? ParentDuration);
|
||||
|
||||
@@ -344,7 +344,7 @@ public class HlsSessionWorker : IHlsSessionWorker
|
||||
|
||||
DateTimeOffset now = _state is HlsSessionState.SeekAndWorkAhead
|
||||
? 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;
|
||||
|
||||
var request = new GetPlayoutItemProcessByChannelNumber(
|
||||
|
||||
@@ -93,8 +93,7 @@
|
||||
DialogResult result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
var duration = result.Data as int?;
|
||||
await Mediator.Send(new UpdateImageFolderDuration(item.LibraryFolderId, duration), _cts.Token);
|
||||
int? duration = await Mediator.Send(new UpdateImageFolderDuration(item.LibraryFolderId, result.Data as int?), _cts.Token);
|
||||
item.UpdateDuration(duration);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user