Raccolta (M0/M2): sito di prova completo, lettori per forma, ricette su browser vero, coda degli scaricamenti, sonda con ripulitura e verifica; documenti delle ipotesi e delle prove dal vivo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
74 files changed
+12689
-13
No files matched your search
@@ -175,6 +175,36 @@ internal sealed class MediaStore(FebeDatabase db) : IMediaStore
|
||||
ct);
|
||||
}
|
||||
|
||||
public Task<IReadOnlyList<Media>> AddToEntryAsync(long entryId, IReadOnlyList<Media> media, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(media);
|
||||
if (media.Any(m => m.Position < 1))
|
||||
{
|
||||
throw new ArgumentException("Le posizioni dei file partono da 1.", nameof(media));
|
||||
}
|
||||
|
||||
return db.WriteAsync<IReadOnlyList<Media>>(
|
||||
w =>
|
||||
{
|
||||
if (ReadEntryById(w.Command, entryId) is null)
|
||||
{
|
||||
throw new KeyNotFoundException($"Elemento {entryId} non trovato.");
|
||||
}
|
||||
|
||||
var present = ReadMediaOf(w.Command, entryId).Select(m => m.Position).ToHashSet();
|
||||
foreach (var file in media.OrderBy(m => m.Position).Where(m => present.Add(m.Position)))
|
||||
{
|
||||
var command = w.Command(InsertMediaSql);
|
||||
BindMedia(command, file with { EntryId = entryId, Sha256 = file.Sha256?.ToLowerInvariant(), InstagramId = NormalizeId(file.InstagramId) });
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
RecomputeState(w, entryId);
|
||||
return ReadMediaOf(w.Command, entryId);
|
||||
},
|
||||
ct);
|
||||
}
|
||||
|
||||
public Task UpdateSourceAsync(long mediaId, string? sourceUrl, string? coverUrl, DateTimeOffset seenAt, CancellationToken ct = default) =>
|
||||
db.WriteAsync(
|
||||
w =>
|
||||
|
||||
Reference in new issue
Block a user