Implement metadata management features in PLib video library manager. Introduce functionality to query and apply metadata from external sources based on video fingerprints. Update ILibraryService and LibraryService to support metadata lookup and application, enhancing video item descriptions and labels. Revise UI components in VideoPlayerView and SettingsView to facilitate user interaction with metadata sources. Update README.md to document new metadata features and usage instructions.

This commit is contained in:
Leonid Pershin
2026-08-09 08:18:40 +03:00
parent c41a458d0b
commit eb4894428b
31 changed files with 1442 additions and 194 deletions
@@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
namespace PLib.Application.Metadata;
/// <summary>Where PLib may go looking for information about a video it has on disk.</summary>
public sealed class MetadataOptions
{
public const string SectionName = "Metadata";
/// <summary>
/// The configured sources, in the order they were added. Empty by default: talking to a
/// remote service about the user's files is something they have to ask for.
/// </summary>
public IList<MetadataSourceOptions> Sources { get; init; } = [];
}
/// <summary>One GraphQL endpoint that can be asked about a video.</summary>
public sealed class MetadataSourceOptions
{
/// <summary>What to call it in the interface; the endpoint is no use as a label.</summary>
[Required]
public string Name { get; init; } = string.Empty;
/// <summary>Absolute URL of the GraphQL endpoint.</summary>
[Required]
public string Endpoint { get; init; } = string.Empty;
/// <summary>
/// Sent as the <c>ApiKey</c> header. Stored in the settings file in plain text — the same
/// place and the same protection the rest of the settings get, which is the file system's.
/// </summary>
public string ApiKey { get; init; } = string.Empty;
/// <summary>False for a source the user has switched off without deleting it.</summary>
public bool IsEnabled { get; init; } = true;
/// <summary>True when this entry has enough filled in to be worth calling.</summary>
public bool IsUsable =>
IsEnabled &&
!string.IsNullOrWhiteSpace(Endpoint) &&
Uri.TryCreate(Endpoint, UriKind.Absolute, out _);
}