refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,82 @@
|
||||
using System.IO;
|
||||
using Chronos.Core.Diagnostics;
|
||||
using Chronos.Core.Imaging;
|
||||
|
||||
namespace Chronos.Uploader.Sources;
|
||||
|
||||
/// <summary>A photo found on disk. <see cref="Root"/> is the dropped folder (or the file's folder) it was found under.</summary>
|
||||
public sealed record SourceFile(string Path, long Size, DateTime ModifiedUtc, DateTime CapturedAt, string Root);
|
||||
|
||||
/// <summary>Finds supported photos under dropped files, folders and card roots (BRIEF §15: zero analysis).</summary>
|
||||
public static class PhotoScanner
|
||||
{
|
||||
private static readonly EnumerationOptions Recursive = new()
|
||||
{
|
||||
RecurseSubdirectories = true,
|
||||
IgnoreInaccessible = true,
|
||||
// Skips "System Volume Information", "$RECYCLE.BIN" and camera housekeeping files.
|
||||
AttributesToSkip = FileAttributes.Hidden | FileAttributes.System,
|
||||
MatchType = MatchType.Simple,
|
||||
};
|
||||
|
||||
/// <summary>Supported photos under <paramref name="paths"/>, in path order, without duplicates.</summary>
|
||||
public static IReadOnlyList<SourceFile> Scan(IEnumerable<string> paths, CancellationToken ct = default)
|
||||
{
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
var result = new List<SourceFile>();
|
||||
foreach (var raw in paths)
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
string full;
|
||||
try
|
||||
{
|
||||
full = Path.GetFullPath(raw);
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or PathTooLongException)
|
||||
{
|
||||
Log.Warning("scan", $"Ignored path {raw}", ex);
|
||||
continue;
|
||||
}
|
||||
if (Directory.Exists(full))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var file in Files(full, ct))
|
||||
{
|
||||
if (seen.Add(file.FullName)) result.Add(ToSource(file, full));
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
// A card pulled mid-scan: keep what was found; the rest can be dropped again.
|
||||
Log.Warning("scan", $"Listing of {full} stopped early", ex);
|
||||
}
|
||||
}
|
||||
else if (File.Exists(full) && ImageFormatInfo.IsSupportedExtension(full) && seen.Add(full))
|
||||
{
|
||||
var info = new FileInfo(full);
|
||||
result.Add(ToSource(info, info.DirectoryName ?? full));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>Supported photos under <paramref name="folder"/>, recursively. I/O errors while listing propagate.</summary>
|
||||
public static IEnumerable<FileInfo> Files(string folder, CancellationToken ct = default)
|
||||
{
|
||||
foreach (var file in new DirectoryInfo(folder).EnumerateFiles("*", Recursive))
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
if (ImageFormatInfo.IsSupportedExtension(file.Name)) yield return file;
|
||||
}
|
||||
}
|
||||
|
||||
public static SourceFile ToSource(FileInfo file, string root) =>
|
||||
new(file.FullName, file.Length, file.LastWriteTimeUtc, CaptureTime(file), root);
|
||||
|
||||
/// <summary>
|
||||
/// Capture time read cheaply: the file's last-write time in local wall-clock, which cameras set to the shot time.
|
||||
/// Exif dates replace it when the metadata reader lands in Chronos.Core.
|
||||
/// </summary>
|
||||
public static DateTime CaptureTime(FileInfo file) => DateTime.SpecifyKind(file.LastWriteTime, DateTimeKind.Unspecified);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Chronos.Uploader.Sources;
|
||||
|
||||
/// <summary>The last session of a source, so later files within the gap join it (watch folders).</summary>
|
||||
public sealed record SessionContinuation(string Key, DateTime LastCapture);
|
||||
|
||||
/// <summary>Session key per input frame (input order) and the session the next batch may continue.</summary>
|
||||
public sealed record SessionAssignment(IReadOnlyList<string> Keys, SessionContinuation? Last);
|
||||
|
||||
/// <summary>
|
||||
/// Splits frames of one source into shooting sessions with the card-import rules (BRIEF §13): a gap longer than
|
||||
/// <see cref="Gap"/> starts a session; sessions with fewer than <see cref="MinimumFrames"/> frames (test shots) merge
|
||||
/// into the previous session, or into the next one when they come first. The server turns each key into a sequence.
|
||||
/// </summary>
|
||||
public static class SessionGrouper
|
||||
{
|
||||
/// <summary><c>SessionGapMinutes</c> default.</summary>
|
||||
public static readonly TimeSpan Gap = TimeSpan.FromMinutes(45);
|
||||
|
||||
/// <summary><c>MinimumSessionFrames</c> default.</summary>
|
||||
public const int MinimumFrames = 8;
|
||||
|
||||
/// <summary>Groups <paramref name="captureTimes"/>; keys start with <paramref name="sourceTag"/> so sources never collide.</summary>
|
||||
public static SessionAssignment Assign(IReadOnlyList<DateTime> captureTimes, string sourceTag, SessionContinuation? previous = null)
|
||||
{
|
||||
if (captureTimes.Count == 0) return new SessionAssignment([], previous);
|
||||
var order = Enumerable.Range(0, captureTimes.Count).OrderBy(i => captureTimes[i]).ToArray();
|
||||
|
||||
// Split on gaps; a group that continues the previous batch keeps its key and is never "small".
|
||||
var groups = new List<Group>();
|
||||
var current = new Group { Continues = previous is not null && (captureTimes[order[0]] - previous.LastCapture).Duration() <= Gap };
|
||||
for (var n = 0; n < order.Length; n++)
|
||||
{
|
||||
var i = order[n];
|
||||
if (n > 0 && captureTimes[i] - captureTimes[order[n - 1]] > Gap)
|
||||
{
|
||||
groups.Add(current);
|
||||
current = new Group();
|
||||
}
|
||||
current.Members.Add(i);
|
||||
}
|
||||
groups.Add(current);
|
||||
|
||||
var merged = new List<Group>();
|
||||
foreach (var g in groups)
|
||||
{
|
||||
if (merged.Count > 0 && g.Members.Count < MinimumFrames) merged[^1].Members.AddRange(g.Members);
|
||||
else merged.Add(g);
|
||||
}
|
||||
if (merged.Count > 1 && merged[0].Members.Count < MinimumFrames && !merged[0].Continues)
|
||||
{
|
||||
merged[0].Members.AddRange(merged[1].Members);
|
||||
merged.RemoveAt(1);
|
||||
}
|
||||
|
||||
var keys = new string[captureTimes.Count];
|
||||
string? lastKey = null;
|
||||
foreach (var g in merged)
|
||||
{
|
||||
var first = g.Members.Min(i => captureTimes[i]);
|
||||
lastKey = g.Continues ? previous!.Key : Key(sourceTag, first);
|
||||
foreach (var i in g.Members) keys[i] = lastKey;
|
||||
}
|
||||
var lastCapture = captureTimes[order[^1]];
|
||||
if (previous is not null && previous.LastCapture > lastCapture && merged[^1].Continues) lastCapture = previous.LastCapture;
|
||||
return new SessionAssignment(keys, new SessionContinuation(lastKey!, lastCapture));
|
||||
}
|
||||
|
||||
/// <summary>Short stable tag for a source folder: 8 hex digits of the SHA-256 of its normalised path.</summary>
|
||||
public static string SourceTag(string root)
|
||||
{
|
||||
var normalized = Path.TrimEndingDirectorySeparator(Path.GetFullPath(root)).ToUpperInvariant();
|
||||
return Convert.ToHexStringLower(SHA256.HashData(Encoding.UTF8.GetBytes(normalized)))[..8];
|
||||
}
|
||||
|
||||
/// <summary><c>{tag}-{yyyyMMdd-HHmmss}</c> of the session's first frame.</summary>
|
||||
public static string Key(string sourceTag, DateTime firstCapture) =>
|
||||
sourceTag + "-" + firstCapture.ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture);
|
||||
|
||||
private sealed class Group
|
||||
{
|
||||
public List<int> Members { get; } = [];
|
||||
public bool Continues { get; init; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user