Enhance video library management in PLib by introducing folder change tracking and improving video item metadata handling. Update IVideoRepository to include a method for loading video items with labels. Revise VideoPlayerViewModel to manage playback progress and integrate new UI elements for displaying watched status and resume options. Update MainWindowViewModel to observe folder changes for automatic rescanning. Enhance README.md to document these new features and usage instructions.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using PLib.Application.Abstractions;
|
||||
using PLib.Domain.Videos;
|
||||
|
||||
namespace PLib.Tests.Library;
|
||||
|
||||
/// <summary>Hand-written double mirroring the EF repository's lookup-by-normalized-name rule.</summary>
|
||||
internal sealed class InMemoryLabelRepository : ILabelRepository
|
||||
{
|
||||
private readonly List<LibraryLabel> _labels = [];
|
||||
|
||||
public Task<IReadOnlyList<LibraryLabel>> GetAllAsync(CancellationToken cancellationToken = default) =>
|
||||
Task.FromResult<IReadOnlyList<LibraryLabel>>([.. _labels]);
|
||||
|
||||
public Task<LibraryLabel?> FindAsync(
|
||||
LabelKind kind,
|
||||
string name,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var normalized = LibraryLabel.Normalize(name);
|
||||
|
||||
return Task.FromResult(_labels.FirstOrDefault(
|
||||
label => label.Kind == kind && label.NormalizedName == normalized));
|
||||
}
|
||||
|
||||
public Task AddAsync(LibraryLabel label, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_labels.Add(label);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task RemoveAsync(LibraryLabel label, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_labels.Remove(label);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user