mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
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:
1 parent
4ee2976806
commit
565fe68239
98 files changed
+5845
-630
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MediaContributor"/> domain aggregate.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaContributorFixture
|
||||
{
|
||||
private readonly MediaContributorIdFixture _mediaContributorIdFixture = new();
|
||||
private readonly MediaContributorNameFixture _mediaContributorNameFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="MediaContributor"/> domain aggregate.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the contributor.</param>
|
||||
/// <param name="name">Optional. The name of the contributor.</param>
|
||||
/// <param name="biography">Optional. The biography of the contributor.</param>
|
||||
/// <param name="dateOfBirth">Optional. The date of birth of the contributor.</param>
|
||||
/// <param name="dateOfDeath">Optional. The date of death of the contributor.</param>
|
||||
/// <returns>The created <see cref="MediaContributor"/> domain aggregate.</returns>
|
||||
public MediaContributor Create(
|
||||
MediaContributorId? id = null,
|
||||
MediaContributorName? name = null,
|
||||
Optional<string>? biography = null,
|
||||
Optional<DateOnly>? dateOfBirth = null,
|
||||
Optional<DateOnly>? dateOfDeath = null)
|
||||
{
|
||||
Result<MediaContributor> result = MediaContributor.Create(
|
||||
id ?? _mediaContributorIdFixture.Create(),
|
||||
name ?? _mediaContributorNameFixture.Create(),
|
||||
biography ?? Optional<string>.None(),
|
||||
dateOfBirth ?? Optional<DateOnly>.None(),
|
||||
dateOfDeath ?? Optional<DateOnly>.None());
|
||||
|
||||
if (result.IsFailure)
|
||||
throw new InvalidOperationException("Failed to create MediaContributor: " + string.Join(", ", result.Errors));
|
||||
return result.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MediaContributor"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MediaContributor"/> instances.</returns>
|
||||
public List<MediaContributor> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -22,11 +23,11 @@ public class MediaContributorRoleFixture
|
||||
/// <param name="name">Optional. The name of the role. If not provided, a random name is generated.</param>
|
||||
/// <param name="category">Optional. The category of the role. If not provided, a random category is generated.</param>
|
||||
/// <returns>The created <see cref="MediaContributorRole"/>.</returns>
|
||||
public MediaContributorRole Create(string? name = null, string? category = null)
|
||||
public MediaContributorRole Create(string? name = null, MediaContributorRoleCategory? category = null)
|
||||
{
|
||||
return MediaContributorRole.Create(
|
||||
name ?? _faker.Lorem.Word(),
|
||||
category ?? _faker.Commerce.Department());
|
||||
category ?? _faker.PickRandom<MediaContributorRoleCategory>()).Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user