Fase 2 stap A: write-through van de Hero naar de bibliotheek (schakelaar uit), per-slide uitsnede en set in de bibliotheek

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 23:05:35 +01:00
co-authored by Claude Sonnet 5.5
parent ed0b6ad61c
commit 369bf73666
18 changed files with 332 additions and 15 deletions
@@ -29,12 +29,13 @@ public sealed class MediaLibraryCopier(MediaDbContext db, IEnumerable<IMediaMigr
{
private static readonly JsonSerializerOptions Json = new(JsonSerializerDefaults.Web);
public async Task<MediaCopyReport> CopyAsync(CancellationToken cancellationToken)
/// <param name="onlyModule">Mirror only this module (the write-through); null = every module (the verified copy).</param>
public async Task<MediaCopyReport> CopyAsync(CancellationToken cancellationToken, string? onlyModule = null)
{
var assets = new List<MediaAssetSnapshot>();
var uses = new List<MediaUseSnapshot>();
var modules = new List<string>();
foreach (var source in sources)
foreach (var source in sources.Where(s => onlyModule is null || s.Module == onlyModule))
{
modules.Add(source.Module);
assets.AddRange(await source.ListAssetsAsync(cancellationToken));
@@ -139,7 +140,7 @@ public sealed class MediaLibraryCopier(MediaDbContext db, IEnumerable<IMediaMigr
row.Position = snapshot.Position;
row.Active = snapshot.Active;
row.SetHash = snapshot.SetHash;
row.Crops = cropsByAsset.TryGetValue(snapshot.AssetId, out var crops) ? crops : "[]";
row.Crops = snapshot.Crops is not null ? JsonSerializer.Serialize(snapshot.Crops, Json) : cropsByAsset.TryGetValue(snapshot.AssetId, out var crops) ? crops : "[]";
}
// What is left no longer exists at the source.