E5: API e interfaccia delle copie automatiche e di «Riconosci»

L'interfaccia di programmazione e le pagine mostrano e usano ciò che i
pacchetti precedenti hanno costruito nel nucleo.

- API: le modifiche delle destinazioni passano da ChangeDestinationAsync
  (spegnere «Automatica» ferma subito la sua copia automatica, risposta
  52); nuova /api/export/automatic-preview (switchOn, widen, removeOwn,
  account) per la domanda «Solo i nuovi / Copia anche gli N» e i file in
  più (risposta 55); /destinations/{id}/recognize; /automatic/resume
  («Riprendi ora»); «Interrompi» su una copia automatica dice fino a che
  ora le copie automatiche restano ferme (risposta 53); runs?unfinished;
  avanzamento con tipo e origine; destinazioni con «dal» e i file che
  aspettano una cartella in pausa; stato delle copie automatiche nella
  panoramica (null senza il lavoratore, quindi nella dimostrazione);
  «da riprendere» conta solo i lavori di Alberto.
- Interfaccia: l'interruttore «Automatica» nella finestra della
  destinazione con la domanda all'accensione, i file in più e l'avviso
  allo spegnimento; stato della cartella condiviso da Impostazioni e
  scheda account (pausa «dal …», file che aspettano, «Riprova»,
  «Controlla le copie», «Riconosci le copie già presenti»); Dashboard con
  i nomi dei lavori automatici e di riconoscimento, la riga delle copie
  automatiche con «Riprendi ora», «Da riprendere» con ogni lavoro non
  finito e la copia manuale pronta a ripartire (risposta 48).
- Prove API in ExportApiTests.Automatic.cs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 16:30:25 +01:00
1 parent e66e322d35
commit f8491529ca
12 files changed
+1247 -113

No files matched your search

+65 -10
View File
@@ -22,7 +22,10 @@ public sealed record ExportSchemesDto(string General, string Highlight, string P
/// of its pause (or, with <c>/status</c>, why it does not answer now). <paramref name="Counts"/>: copies per state
/// (<c>copied</c>, <c>removed</c>, <c>superseded</c>, <c>failed</c>). <paramref name="Reachable"/> and
/// <paramref name="FreeBytes"/> only from <c>/status</c>. <paramref name="Orphan"/>: an own folder whose account was
/// removed («era di @<paramref name="FormerUsername"/>»).
/// removed («era di @<paramref name="FormerUsername"/>»). Tappa E5: <paramref name="Automatic"/> is «Automatica»,
/// <paramref name="AutomaticSince"/> its «Solo i nuovi» instant («Automatica dal …»; null with «Copia anche quelli già
/// in libreria» or when it is off); <paramref name="Waiting"/>, only for a destination in pause, the files that wait for
/// it: what it would copy by itself when it is automatic, else what its unfinished jobs still have to copy.
/// </summary>
public sealed record ExportDestinationDto(
long Id,
@@ -45,14 +48,18 @@ public sealed record ExportDestinationDto(
bool Orphan = false,
string? FormerUsername = null,
string? PhotoFormat = null,
string? VideoFormat = null);
string? VideoFormat = null,
LocalTimeDto? AutomaticSince = null,
int? Waiting = null);
/// <summary>
/// <c>GET /api/export</c>: Impostazioni → Esportazione and the notice of the Dashboard. <paramref name="SamePost"/>:
/// <c>onePerAccount</c> or <c>oneOnly</c>. <paramref name="UnfinishedRuns"/>: interrupted or paused jobs («Riprendi»).
/// <c>onePerAccount</c> or <c>oneOnly</c>. <paramref name="UnfinishedRuns"/>: interrupted or paused jobs of Alberto
/// («Riprendi»); the automatic ones resume by themselves and are not counted (tappa E5).
/// Formats (tappa E3) on the wire: <c>original</c>, <c>jpg</c>, <c>png</c>, <c>webplossless</c>, <c>mp4</c>; the
/// library ones are <c>original</c> while the conversion of the library is off. <paramref name="LibraryConversion"/>:
/// the state of that conversion.
/// the state of that conversion. <paramref name="Automatic"/>: the automatic copies (tappa E5), null when they do not
/// run (the demonstration, a start with problems).
/// </summary>
public sealed record ExportOverviewDto(
ExportRootDto Root,
@@ -66,7 +73,46 @@ public sealed record ExportOverviewDto(
string VideoFormat = "original",
string LibraryPhotoFormat = "original",
string LibraryVideoFormat = "original",
LibraryConversionDto? LibraryConversion = null);
LibraryConversionDto? LibraryConversion = null,
ExportAutomaticStatusDto? Automatic = null);
/// <summary>
/// The automatic copies now (tappa E5, spec §4.10): <paramref name="AnyAutomatic"/> a destination in use has «Automatica»
/// on; <paramref name="Waiting"/> why they wait (an engine session, an import, a copy of Alberto's…), or null;
/// <paramref name="LastRound"/> and <paramref name="NextRound"/> of the recovery round («giro di recupero», at start-up and
/// every hour); <paramref name="HeldUntil"/>: «Interrompi» stopped them until then («Riprendi ora»).
/// </summary>
public sealed record ExportAutomaticStatusDto(bool AnyAutomatic, string? Waiting, LocalTimeDto? LastRound, LocalTimeDto? NextRound, LocalTimeDto? HeldUntil);
/// <summary>
/// <c>POST /api/export/automatic-preview</c> (tappa E5): how many files an automatic destination would copy by itself.
/// <paramref name="Mode"/>:
/// <c>switchOn</c>, the question «Solo i nuovi / Copia anche gli N già in libreria» when «Automatica» is turned on (the
/// destination as the dialog has it: <paramref name="Scope"/>, <paramref name="AccountId"/>, <paramref name="Path"/>,
/// <paramref name="Types"/>; the copies of <paramref name="DestinationId"/> count only while the folder stays the same);
/// <c>widen</c>, the files in more when <paramref name="Types"/> add types to the automatic destination
/// <paramref name="DestinationId"/>;
/// <c>removeOwn</c>, the files of <paramref name="AccountId"/> that go by themselves to the automatic general folder
/// once its own folder is taken away;
/// <c>account</c>, the files of <paramref name="AccountId"/> that its automatic destination copies by itself
/// («Esporta questo account» turned on again).
/// </summary>
public sealed record ExportAutomaticPreviewRequest(
string Mode,
long? DestinationId = null,
string? Scope = null,
long? AccountId = null,
string? Path = null,
IReadOnlyList<string>? Types = null);
/// <summary>
/// What <c>POST /api/export/automatic-preview</c> counted: <paramref name="Files"/>, the bytes of their originals
/// («circa»), the line to show and, for a stored folder, its free space (null when unknown).
/// </summary>
public sealed record ExportAutomaticPreviewDto(int Files, long Bytes, string Text, long? FreeBytes = null);
/// <summary>«Riconosci le copie già presenti» started (tappa E5): the message and the job.</summary>
public sealed record ExportRecognizeStartedDto(string Message, long RunId);
/// <summary>
/// The conversion of the library (tappa E3, spec §4.10): files in the queue, converted, failed («Riprova»), that never
@@ -116,7 +162,8 @@ public sealed record ExportNamingPreviewRequest(string Scope, string? General, s
/// <summary>
/// A destination to add or change. <paramref name="Path"/>: in Docker the folder relative to <c>/esporta</c> (as listed),
/// elsewhere the full path. <paramref name="Types"/>: wire names, at least one. Null or empty schemes: «Come la
/// libreria». «Automatica» is stored only (tappa E5 acts on it).
/// libreria». <paramref name="Automatic"/>: «Automatica» (tappa E5); <paramref name="OnlyNew"/> is the answer when it is
/// turned on («Solo i nuovi»; false: «Copia anche quelli già in libreria»), kept while it stays on.
/// </summary>
public sealed record ExportDestinationRequest(
string Scope,
@@ -217,7 +264,9 @@ public sealed record CopyAgainRequest(long CopyId);
/// <summary>
/// <c>GET /api/export/progress</c>, polled by the Dashboard tab. <paramref name="Phase"/>: preparing, checking,
/// waitingForSession, copying, finished. <paramref name="ByState"/>: files of the job per state.
/// waitingForSession, copying, finished. <paramref name="ByState"/>: files of the job per state. Tappa E5, from the job
/// being worked on: <paramref name="Kind"/> <c>copy</c> or <c>recognize</c> (null for «Controlla le copie»),
/// <paramref name="Origin"/> <c>manual</c> or <c>automatic</c>.
/// </summary>
public sealed record ExportProgressDto(
long? RunId,
@@ -231,7 +280,9 @@ public sealed record ExportProgressDto(
string? Destination,
IReadOnlyDictionary<string, int> ByState,
bool Running,
string? Error);
string? Error,
string? Kind = null,
string? Origin = null);
/// <summary>An export job. <paramref name="Kind"/>: copy or recognize; <paramref name="Origin"/>: manual or automatic.</summary>
public sealed record ExportRunDto(
@@ -259,7 +310,9 @@ public sealed record ExportReportLineDto(long ItemId, string Username, string? P
/// <summary>
/// The report of a job (at most 200 problems). <paramref name="Notes"/> (tappa E3): files copied or adopted with a note
/// (what a conversion could not keep, a file copied as it is), at most 200.
/// (what a conversion could not keep, a file copied as it is), at most 200. Tappa E5, for «Riconosci le copie già
/// presenti»: of the skipped files, <paramref name="NotFound"/> are not in the folder and <paramref name="Different"/>
/// have another file where the copy would be (those are problems; the ones not found are not).
/// </summary>
public sealed record ExportReportDto(
ExportRunDto Run,
@@ -267,7 +320,9 @@ public sealed record ExportReportDto(
long BytesCopied,
IReadOnlyList<ExportReportAccountDto> Accounts,
IReadOnlyList<ExportReportLineDto> Problems,
IReadOnlyList<ExportReportLineDto>? Notes = null);
IReadOnlyList<ExportReportLineDto>? Notes = null,
int NotFound = 0,
int Different = 0);
/// <summary>
/// A copy of a file of the viewer (spec §4.6, §4.10). <paramref name="State"/>: copied, removed, superseded, failed;