Interfaccia, parte 2: Attività, Impostazioni, collegamento, Importa, doppioni, primo avvio ed errori di configurazione
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
90 files changed
+7825
-49
No files matched your search
@@ -59,6 +59,9 @@ public sealed class DemoWorld
|
||||
public required long MineId { get; init; }
|
||||
|
||||
public required string MineUsername { get; init; }
|
||||
|
||||
/// <summary>Sample pictures in the proportions of a story (the browser preview of the demo).</summary>
|
||||
public IReadOnlyList<string> StoryPictures { get; init; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -551,11 +554,13 @@ public static class DemoSeeder
|
||||
.ToList();
|
||||
|
||||
var mine = accounts.First(a => a.Spec.Mine).Account;
|
||||
var variants = await DemoDuplicates.SeedAsync(storage, thumbnails, pictures, now, ct).ConfigureAwait(false);
|
||||
return new DemoWorld
|
||||
{
|
||||
SeededAt = now,
|
||||
Zone = zone,
|
||||
Pictures = pool.Files,
|
||||
Pictures = pool.Files.Concat(variants).ToDictionary(p => p.Key, p => p.Value, StringComparer.Ordinal),
|
||||
StoryPictures = [.. pool.All.Where(p => p.Shape == PictureShape.Story).Select(p => p.Path)],
|
||||
WindowStart = windowToday.Start,
|
||||
WindowEnd = windowToday.End,
|
||||
NextWindowStart = nextWindow,
|
||||
@@ -840,6 +845,7 @@ public static class DemoSeeder
|
||||
RelativePath = relative,
|
||||
Bytes = isVideo ? random.Next(2_000_000, 38_000_000) : picture.Bytes,
|
||||
Sha256 = picture.Sha256,
|
||||
PerceptualHash = isVideo ? null : picture.PerceptualHash,
|
||||
HasThumbnail = true,
|
||||
DownloadedAt = entry.DownloadedAt,
|
||||
});
|
||||
@@ -938,7 +944,7 @@ public enum PictureShape
|
||||
}
|
||||
|
||||
/// <summary>A sample picture on disk.</summary>
|
||||
public sealed record DemoPicture(DemoSubject Subject, PictureShape Shape, string Path, string Sha256, int Width, int Height, long Bytes);
|
||||
public sealed record DemoPicture(DemoSubject Subject, PictureShape Shape, string Path, string Sha256, int Width, int Height, long Bytes, ulong? PerceptualHash = null);
|
||||
|
||||
/// <summary>The shared sample pictures of the demo, with their thumbnails.</summary>
|
||||
public sealed class DemoPictures
|
||||
@@ -998,7 +1004,13 @@ public sealed class DemoPictures
|
||||
thumbnails.Create(sha, stream);
|
||||
}
|
||||
|
||||
results[i] = new DemoPicture(subject, shape, path, sha, width, height, bytes.Length);
|
||||
ulong? hash;
|
||||
using (var stream = new MemoryStream(bytes))
|
||||
{
|
||||
hash = Febe.Core.Library.PerceptualHash.Compute(stream);
|
||||
}
|
||||
|
||||
results[i] = new DemoPicture(subject, shape, path, sha, width, height, bytes.Length, hash);
|
||||
});
|
||||
return new DemoPictures(results);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user