D1, quarta parte: «Raggruppa i post» o «Tutte le foto» in Libreria e scheda account

Un post con più foto era una tessera sola: per vederle tutte bisognava aprirlo.
Ora un interruttore nella riga degli strumenti (Libreria e Contenuti
dell'account, non «In evidenza») passa a una tessera per file, video dei
caroselli compresi, con la posizione «2/4» sulla tessera; la scelta resta nel
browser, una per pagina, e il predefinito è raggruppato (§4.6).

- API: /api/library e /api/library/days accettano mode=files; il cursore
  diventa «ms.elemento.posizione», i giorni contano file e il totale dice anche
  quanti file. Le finestre restano a chiavi sull'indice di pubblicazione; per i
  conteggi un indice ix_media_entry_files (entry_id, state, kind) nella
  migrazione 0002 non ancora unita. Prova di scala a 200.000 elementi: finestre
  6-11 ms, conteggi 0,2-0,3 s.
- Visualizzatore: si apre sul file della tessera e va di file in file, anche da
  un elemento al successivo («Libreria, file 12 di 30.340»).
- Selezione di file; elenco CSV ed «Elimina» lavorano sugli elementi interi e
  lo dicono («3 file scelti appartengono a 2 elementi: elimino gli elementi
  interi, 9 file»). «Copia in…» non è in questo ramo.
- Dimostrazione: alcune serie hanno un video in seconda posizione, scelto
  dall'identificativo senza toccare la sequenza casuale.
- Prove di archivio, API, dimostrazione e interfaccia (queste ultime con
  Chromium, solo nella CI); guida e decisioni aggiornate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-25 16:40:07 +01:00
1 parent 34fe5e9073
commit 30e159cbd4
23 files changed
+1126 -130

No files matched your search

+11 -2
View File
@@ -81,8 +81,17 @@ public interface IEntryStore
Task<LibraryTotals> GetLibraryTotalsAsync(LibraryFilter filter, CancellationToken ct = default);
/// <summary>Entries per local calendar day in Alberto's zone, newest day first.</summary>
Task<IReadOnlyList<DayCount>> CountLibraryByDayAsync(LibraryFilter filter, TimeZoneInfo zone, CancellationToken ct = default);
/// <summary>
/// Files of the entries of the filter that are in the library (downloaded or imported): the tiles of
/// «Tutte le foto». With «Foto» and «Video» only the files of that kind.
/// </summary>
Task<int> CountLibraryFilesAsync(LibraryFilter filter, CancellationToken ct = default);
/// <summary>
/// Entries (or, with <see cref="MosaicMode.Files"/>, files) per local calendar day in Alberto's zone, newest day
/// first. A day without files is left out in that mode.
/// </summary>
Task<IReadOnlyList<DayCount>> CountLibraryByDayAsync(LibraryFilter filter, TimeZoneInfo zone, MosaicMode mode = MosaicMode.Grouped, CancellationToken ct = default);
/// <summary>Tiles for given entries, in the given order (e.g. the items of a highlight collection).</summary>
Task<IReadOnlyList<LibraryTile>> GetTilesAsync(IReadOnlyList<long> entryIds, CancellationToken ct = default);
+28 -5
View File
@@ -56,8 +56,25 @@ public sealed record LibraryFilter
public IReadOnlyList<EntryState>? States { get; init; }
}
/// <summary>Keyset position in the library order (publication time descending, then id descending).</summary>
public readonly record struct LibraryCursor(DateTimeOffset PublishedAt, long EntryId)
/// <summary>
/// «Raggruppa i post» or «Tutte le foto» (spec §4.6): one tile per entry, the default, or one tile per file of the
/// library (videos included), in the same order: publication of the entry, then position in the series.
/// </summary>
public enum MosaicMode
{
/// <summary>«Raggruppa i post»: one tile per entry, with its cover.</summary>
Grouped,
/// <summary>«Tutte le foto»: one tile per file present in the library (downloaded or imported).</summary>
Files,
}
/// <summary>
/// Keyset position in the library order (publication time descending, then id descending). With
/// <see cref="MosaicMode.Files"/> <see cref="Position"/> continues inside the entry: the window goes on after the file at
/// that position (0: before every file of the entry). <see cref="MosaicMode.Grouped"/> ignores it.
/// </summary>
public readonly record struct LibraryCursor(DateTimeOffset PublishedAt, long EntryId, int Position = 0)
{
/// <summary>A cursor that starts the older direction at a given instant (to jump to a date).</summary>
public static LibraryCursor At(DateTimeOffset instant) => new(instant, long.MaxValue);
@@ -81,13 +98,18 @@ public sealed record LibraryQuery
public LibraryDirection Direction { get; init; } = LibraryDirection.Older;
/// <summary>One tile per entry (default) or per file.</summary>
public MosaicMode Mode { get; init; } = MosaicMode.Grouped;
/// <summary>Maximum tiles (1–1000).</summary>
public int Limit { get; init; } = 200;
}
/// <summary>
/// One tile of the mosaic: an entry with its cover file (the file at the lowest position).
/// <see cref="CoverSha256"/> is the thumbnail key.
/// One tile of the mosaic: an entry with its cover file (the file at the lowest position). With
/// <see cref="MosaicMode.Files"/> the tile is one file of the entry: the cover columns describe that file and
/// <see cref="FilePosition"/> is its position in the series (null for an entry tile). <see cref="CoverSha256"/> is the
/// thumbnail key.
/// </summary>
public sealed record LibraryTile(
long EntryId,
@@ -104,7 +126,8 @@ public sealed record LibraryTile(
int? CoverHeight,
TimeSpan? CoverDuration,
string? CoverSha256,
bool CoverHasThumbnail);
bool CoverHasThumbnail,
int? FilePosition = null);
/// <summary>
/// A window of tiles, always in display order (newest first). <see cref="Older"/> and <see cref="Newer"/> continue