Adds independent metadata and artwork enrichment

Splits the single combined enrichment phase of the media library scan into
independent, modular jobs, so that the metadata and the artwork of a book
are enriched separately and only when their respective triggers fire.

- Adds the MediaContributorRoleCategory enum (Other first, then Author,
  Translator, Illustrator, Publisher and Narrator) and makes the role
  category canonical, so that roles describing the same kind of
  contribution are never treated as distinct.
- Realizes the media contributor bounded context: a MediaContributor is a
  person, unique by display name, without a role. The role moves to the
  per-work participation (BookContributors), so that a single contributor
  can play multiple roles. Contributors are created and linked by the
  metadata enrichment job, and exposed to subsequent jobs.
- Makes the Book aggregate pure: the enrichment tracking state (metadata
  status, providers, timestamps and covers) no longer lives on the domain
  aggregate, but stays in the Books table, managed directly by the jobs.
- Models artwork generically as a BookArtwork child table (type, ordinal,
  content hash, status and provider), so that each piece of artwork is
  tracked independently and a change of one does not require the others to
  be re-fetched.
- Splits the scan DAG into ResultsSave, ProviderConfigurationInvalidation,
  MetadataEnrichment and ArtworkEnrichment jobs. The invalidation job
  fingerprints the provider configuration of a library and resets the
  enrichment state of the affected channel when it changed. The artwork job
  resolves the missing artwork, hashing it to detect identical covers and
  skip re-copying. Content-changed books are reset by the results save job.
- Deletes the book and its stored artwork when the file disappears from the
  library.
- Adds the migration creating the new tables, backfilling the existing
  covers into the artwork table, and adding the configuration fingerprints.
- Localizes the new scan job stages, and fixes the invalidation job wiping
  the library content locations by persisting the fingerprints through the
  change tracker instead of the repository update action.
This commit is contained in:
BinaryAlley committed 2026-08-27 14:41:49 +03:00
1 parent 4ee2976806
commit 565fe68239
98 files changed
+5845 -630

No files matched your search

@@ -0,0 +1,22 @@
namespace Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
/// <summary>
/// Enumeration for the status of the artwork enrichment of a book artwork.
/// </summary>
public enum ArtworkStatus
{
/// <summary>
/// The artwork of the book has not been resolved yet.
/// </summary>
Pending,
/// <summary>
/// The artwork of the book has been successfully resolved.
/// </summary>
Enriched,
/// <summary>
/// The artwork resolution of the book failed.
/// </summary>
Failed
}
@@ -0,0 +1,44 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
/// <summary>
/// Enumeration for the canonical category of the role of a media contributor in a media item.
/// The category normalizes the free-form role names returned by the metadata providers, so that roles
/// that describe the same kind of contribution, like "Author" and "Writer", are never treated as distinct.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MediaContributorRoleCategory
{
/// <summary>
/// The role does not fall into any of the known categories.
/// </summary>
Other,
/// <summary>
/// The contributor created the media item, like a book, a movie, or a piece of music.
/// </summary>
Author,
/// <summary>
/// The contributor translated the media item into another language.
/// </summary>
Translator,
/// <summary>
/// The contributor created the illustrations of the media item.
/// </summary>
Illustrator,
/// <summary>
/// The contributor published the media item.
/// </summary>
Publisher,
/// <summary>
/// The contributor narrated the media item.
/// </summary>
Narrator
}
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
/// <summary>
/// Enumeration for the type of artwork of a media library item.
/// Each media library item can have multiple artwork of different types, and multiple instances of the same
/// type (like the booklet pages of an audio album), tracked independently so that a change of one artwork
/// does not require the others to be re-fetched.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum ArtworkType
{
/// <summary>
/// The main artwork of the media library item, like the cover of a book.
/// </summary>
Cover
}