M7 Importazione: sorgenti con sola lettura riconosciuta, analisi in sola lettura interrompibile e ripristinabile (tipo dal contenuto, SHA-256, impronta, date da nome, EXIF scritto a mano, mvhd e ffprobe facoltativo), riconoscitori Febe, generico e 4K Stogram come ipotesi spenta, confronto con la libreria e dentro la sorgente, associazione cartelle-account, decisioni sui doppioni, copia o spostamento verificati con sostituzione sicura, resoconto e CSV; prove

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 18:32:01 +00:00
1 parent 6ff11ac8e3
commit 5e77bdefe0
32 files changed
+7707 -3

No files matched your search

+64
View File
@@ -42,8 +42,72 @@ public interface IImportStore
/// <summary>Associates every file of a source folder with an account (null: not associated).</summary>
Task SetFolderTargetAsync(long runId, string folder, long? accountId, CancellationToken ct = default);
/// <summary>Source folders with their counts by outcome and their association (review table, mockup 09).</summary>
Task<IReadOnlyList<ImportFolderCounts>> ListFolderCountsAsync(long runId, CancellationToken ct = default);
/// <summary>
/// Probable-duplicate pairs of an import (the candidate side is always a file of the import), in creation order.
/// </summary>
Task<IReadOnlyList<DuplicatePair>> ListPairsAsync(long runId, bool pendingOnly, long afterId = 0, int limit = 500, CancellationToken ct = default);
Task<int> CountPairsAsync(long runId, bool pendingOnly, CancellationToken ct = default);
/// <summary>
/// Rows for the final report and the CSV export, by key: each file with the account and path of the library file it
/// matched and the user name of its destination account.
/// </summary>
Task<IReadOnlyList<ImportReportRow>> ListReportRowsAsync(long runId, long afterId = 0, int limit = 1000, CancellationToken ct = default);
/// <summary>Removes the pairs of an import still waiting for a decision (the import was cancelled). Returns how many.</summary>
Task<int> RemovePendingPairsAsync(long runId, CancellationToken ct = default);
/// <summary>Removes an import with its files and pairs. Only records: no file on disk is touched.</summary>
Task DeleteRunAsync(long runId, CancellationToken ct = default);
/// <summary>
/// Instagram identifiers and post codes of the whole library (entries in any state, files with their own
/// identifier), loaded once per analysis for the «same identifier, different file» comparison (spec §9.3).
/// </summary>
Task<LibraryIdentifiers> LoadLibraryIdentifiersAsync(CancellationToken ct = default);
/// <summary>The entry of (account, kind) with this post code, in any state: imported posts known only by their code.</summary>
Task<Entry?> FindEntryByCodeAsync(long accountId, EntryKind kind, string code, CancellationToken ct = default);
}
/// <summary>A source folder of an import with its counts by outcome.</summary>
/// <param name="Folder">Folder relative to the source ('/' separated, empty for the root).</param>
/// <param name="Files">Files of the folder.</param>
/// <param name="Bytes">Their total size.</param>
/// <param name="ProbableAccount">Account guessed from the folder name.</param>
/// <param name="TargetAccountId">Associated account, when chosen.</param>
/// <param name="ByOutcome">Files per outcome (every outcome present, zero included).</param>
/// <param name="Recognized">Files whose Instagram identifier or code is known.</param>
public sealed record ImportFolderCounts(
string Folder,
int Files,
long Bytes,
string? ProbableAccount,
long? TargetAccountId,
IReadOnlyDictionary<ImportOutcome, int> ByOutcome,
int Recognized);
/// <summary>A file of an import for the report, with what it matched and where it went.</summary>
/// <param name="File">The file.</param>
/// <param name="MatchedUsername">Account of the library file it matched («Già in libreria», «Doppione probabile»).</param>
/// <param name="MatchedPath">Path of that library file, relative to its account folder.</param>
/// <param name="TargetUsername">User name of the destination account.</param>
public sealed record ImportReportRow(ImportFile File, string? MatchedUsername, string? MatchedPath, string? TargetUsername);
/// <summary>Identity of an entry of the library: Instagram identifier and post code.</summary>
public sealed record EntryIdentity(long EntryId, long AccountId, EntryKind Kind, EntryState State, string? InstagramId, string? Code);
/// <summary>A file of the library with its own Instagram identifier (an item of a series).</summary>
public sealed record MediaIdentity(long MediaId, long EntryId, string InstagramId);
/// <summary>Identifiers of the whole library.</summary>
public sealed record LibraryIdentifiers(IReadOnlyList<EntryIdentity> Entries, IReadOnlyList<MediaIdentity> Media);
/// <summary>Filters for the files of an import.</summary>
public sealed record ImportFileQuery
{