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,36 @@
|
||||
namespace Chronos.Core.Naming;
|
||||
|
||||
/// <summary>Values available to folder/file templates for one frame (BRIEF §7.1).</summary>
|
||||
public sealed record NamingContext
|
||||
{
|
||||
/// <summary>Camera wall-clock capture time.</summary>
|
||||
public DateTime CapturedAt { get; init; }
|
||||
|
||||
/// <summary>Start of the session the frame belongs to.</summary>
|
||||
public DateTime SessionStart { get; init; }
|
||||
|
||||
/// <summary>1-based session number within the import.</summary>
|
||||
public int Session { get; init; } = 1;
|
||||
|
||||
/// <summary>1-based frame number across the import (or sequence).</summary>
|
||||
public int Number { get; init; } = 1;
|
||||
|
||||
/// <summary>1-based frame number within the session.</summary>
|
||||
public int NumberInSession { get; init; } = 1;
|
||||
|
||||
public string? CameraMake { get; init; }
|
||||
public string? CameraModel { get; init; }
|
||||
public string? Lens { get; init; }
|
||||
public int? Iso { get; init; }
|
||||
public double? ExposureTime { get; init; }
|
||||
public double? FNumber { get; init; }
|
||||
|
||||
/// <summary>Original file name without extension.</summary>
|
||||
public string OriginalName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>Original extension without the dot, as found on the card.</summary>
|
||||
public string Extension { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>Sequence title, when the user gave one.</summary>
|
||||
public string? Title { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Chronos.Core.Naming;
|
||||
|
||||
/// <summary>A parse problem in a template, with the character position for live validation in the UI.</summary>
|
||||
public sealed record TemplateError(int Position, string Code, string? Token);
|
||||
|
||||
/// <summary>
|
||||
/// Folder/file naming templates (BRIEF §7.1). Tokens are written as <c>{name}</c> or <c>{name:format}</c>, where the
|
||||
/// format is passed to the .NET formatter (e.g. <c>{n:0000}</c>, <c>{date:yyyyMMdd}</c>). <c>{{</c> and <c>}}</c> are literal
|
||||
/// braces. Characters that are illegal in Windows/Linux file names are replaced, never passed through.
|
||||
/// </summary>
|
||||
public sealed class PathTemplate
|
||||
{
|
||||
/// <summary>Every token the templates understand. Descriptions are localized resources <c>Import.Token.<name></c>.</summary>
|
||||
public static readonly IReadOnlyList<string> Tokens =
|
||||
[
|
||||
"year", "month", "day", "date", "time", "hm", "session", "sessionstart", "camera", "lens",
|
||||
"iso", "shutter", "aperture", "n", "nsession", "name", "ext", "title",
|
||||
];
|
||||
|
||||
private static readonly HashSet<string> TokenSet = new(Tokens, StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly char[] Illegal = ['<', '>', ':', '"', '|', '?', '*', '\\', '/', '\0'];
|
||||
private static readonly HashSet<string> ReservedNames = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
|
||||
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
|
||||
};
|
||||
|
||||
private readonly List<Part> _parts;
|
||||
|
||||
private PathTemplate(string source, List<Part> parts, IReadOnlyList<TemplateError> errors)
|
||||
{
|
||||
Source = source;
|
||||
_parts = parts;
|
||||
Errors = errors;
|
||||
}
|
||||
|
||||
public string Source { get; }
|
||||
|
||||
/// <summary>Problems found while parsing; a template with errors still expands best-effort.</summary>
|
||||
public IReadOnlyList<TemplateError> Errors { get; }
|
||||
|
||||
public bool IsValid => Errors.Count == 0;
|
||||
|
||||
/// <summary>Parses a template; '/' separates folder levels (only meaningful for folder templates).</summary>
|
||||
public static PathTemplate Parse(string template)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(template);
|
||||
var parts = new List<Part>();
|
||||
var errors = new List<TemplateError>();
|
||||
var literal = new StringBuilder();
|
||||
for (var i = 0; i < template.Length; i++)
|
||||
{
|
||||
var c = template[i];
|
||||
if (c == '{')
|
||||
{
|
||||
if (i + 1 < template.Length && template[i + 1] == '{')
|
||||
{
|
||||
literal.Append('{');
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
var close = template.IndexOf('}', i + 1);
|
||||
if (close < 0)
|
||||
{
|
||||
errors.Add(new TemplateError(i, "UnclosedBrace", null));
|
||||
literal.Append(template, i, template.Length - i);
|
||||
break;
|
||||
}
|
||||
if (literal.Length > 0)
|
||||
{
|
||||
parts.Add(Part.Literal(literal.ToString()));
|
||||
literal.Clear();
|
||||
}
|
||||
var body = template[(i + 1)..close];
|
||||
var colon = body.IndexOf(':', StringComparison.Ordinal);
|
||||
var name = (colon < 0 ? body : body[..colon]).Trim();
|
||||
var format = colon < 0 ? null : body[(colon + 1)..];
|
||||
if (name.Length == 0) errors.Add(new TemplateError(i, "EmptyToken", null));
|
||||
else if (!TokenSet.Contains(name)) errors.Add(new TemplateError(i, "UnknownToken", name));
|
||||
parts.Add(Part.Token(name.ToLowerInvariant(), format));
|
||||
i = close;
|
||||
}
|
||||
else if (c == '}')
|
||||
{
|
||||
if (i + 1 < template.Length && template[i + 1] == '}')
|
||||
{
|
||||
literal.Append('}');
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
errors.Add(new TemplateError(i, "UnopenedBrace", null));
|
||||
}
|
||||
else
|
||||
{
|
||||
literal.Append(c);
|
||||
}
|
||||
}
|
||||
if (literal.Length > 0) parts.Add(Part.Literal(literal.ToString()));
|
||||
if (template.Trim().Length == 0) errors.Add(new TemplateError(0, "Empty", null));
|
||||
return new PathTemplate(template, parts, errors);
|
||||
}
|
||||
|
||||
/// <summary>Expands to a relative folder path (forward slashes; each segment sanitized).</summary>
|
||||
public string ExpandFolder(NamingContext context)
|
||||
{
|
||||
var raw = Expand(context, allowSeparators: true);
|
||||
var segments = raw.Split('/', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(SanitizeSegment)
|
||||
.Where(s => s.Length > 0);
|
||||
return string.Join('/', segments);
|
||||
}
|
||||
|
||||
/// <summary>Expands to a file name; the original extension is appended unless the template already ends with {ext}.</summary>
|
||||
public string ExpandFile(NamingContext context)
|
||||
{
|
||||
var hasExt = _parts.Count > 0 && _parts[^1] is { IsToken: true, Text: "ext" };
|
||||
var name = SanitizeSegment(Expand(context, allowSeparators: false));
|
||||
if (name.Length == 0) name = SanitizeSegment(context.OriginalName);
|
||||
if (!hasExt && context.Extension.Length > 0) name += "." + context.Extension;
|
||||
return name;
|
||||
}
|
||||
|
||||
private string Expand(NamingContext c, bool allowSeparators)
|
||||
{
|
||||
var inv = CultureInfo.InvariantCulture;
|
||||
var sb = new StringBuilder();
|
||||
foreach (var part in _parts)
|
||||
{
|
||||
if (!part.IsToken)
|
||||
{
|
||||
sb.Append(allowSeparators ? part.Text.Replace('\\', '/') : part.Text);
|
||||
continue;
|
||||
}
|
||||
var f = part.Format;
|
||||
var value = part.Text switch
|
||||
{
|
||||
"year" => c.CapturedAt.ToString(f ?? "yyyy", inv),
|
||||
"month" => c.CapturedAt.ToString(f ?? "MM", inv),
|
||||
"day" => c.CapturedAt.ToString(f ?? "dd", inv),
|
||||
"date" => c.CapturedAt.ToString(f ?? "yyyy-MM-dd", inv),
|
||||
"time" => c.CapturedAt.ToString(f ?? "HH-mm-ss", inv),
|
||||
"hm" => c.CapturedAt.ToString(f ?? "HH-mm", inv),
|
||||
"sessionstart" => c.SessionStart.ToString(f ?? "yyyy-MM-dd HH-mm", inv),
|
||||
"session" => c.Session.ToString(f ?? "0", inv),
|
||||
"n" => c.Number.ToString(f ?? "0000", inv),
|
||||
"nsession" => c.NumberInSession.ToString(f ?? "0000", inv),
|
||||
"camera" => CameraName(c.CameraMake, c.CameraModel),
|
||||
"lens" => c.Lens ?? string.Empty,
|
||||
"iso" => c.Iso?.ToString(f ?? "0", inv) ?? string.Empty,
|
||||
"shutter" => Shutter(c.ExposureTime),
|
||||
"aperture" => c.FNumber is { } fn ? "f" + fn.ToString(f ?? "0.#", inv) : string.Empty,
|
||||
"name" => c.OriginalName,
|
||||
"ext" => c.Extension,
|
||||
"title" => c.Title ?? string.Empty,
|
||||
_ => string.Empty,
|
||||
};
|
||||
// Token values never introduce folder levels.
|
||||
sb.Append(value.Replace('/', '-').Replace('\\', '-'));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>"Canon EOS R5" from make "Canon" + model "Canon EOS R5"; avoids the duplicated brand most cameras report.</summary>
|
||||
public static string CameraName(string? make, string? model)
|
||||
{
|
||||
make = make?.Trim();
|
||||
model = model?.Trim();
|
||||
if (string.IsNullOrEmpty(model)) return make ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(make)) return model;
|
||||
var brand = make.Split(' ', StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
if (brand.Equals("NIKON", StringComparison.OrdinalIgnoreCase)) brand = "Nikon";
|
||||
if (model.StartsWith(brand, StringComparison.OrdinalIgnoreCase)) return brand + model[brand.Length..];
|
||||
return brand + " " + model;
|
||||
}
|
||||
|
||||
/// <summary>1/250 s → "1-250", 2 s → "2s" (file-name safe).</summary>
|
||||
public static string Shutter(double? seconds)
|
||||
{
|
||||
if (seconds is not > 0) return string.Empty;
|
||||
var t = seconds.Value;
|
||||
if (t >= 0.3) return t.ToString("0.#", CultureInfo.InvariantCulture) + "s";
|
||||
return "1-" + Math.Round(1 / t).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>Replaces characters that are illegal on Windows or Linux and fixes reserved names and trailing dots/spaces.</summary>
|
||||
public static string SanitizeSegment(string segment)
|
||||
{
|
||||
var sb = new StringBuilder(segment.Length);
|
||||
foreach (var ch in segment)
|
||||
{
|
||||
if (ch < 32 || Array.IndexOf(Illegal, ch) >= 0) sb.Append('_');
|
||||
else sb.Append(ch);
|
||||
}
|
||||
var s = sb.ToString().Trim().TrimEnd('.');
|
||||
while (s.Contains(" ", StringComparison.Ordinal)) s = s.Replace(" ", " ", StringComparison.Ordinal);
|
||||
var stem = s.Split('.')[0];
|
||||
if (ReservedNames.Contains(stem)) s = "_" + s;
|
||||
if (s is "." or "..") s = "_";
|
||||
return s.Length > 200 ? s[..200].TrimEnd() : s;
|
||||
}
|
||||
|
||||
private readonly record struct Part(bool IsToken, string Text, string? Format)
|
||||
{
|
||||
public static Part Literal(string text) => new(false, text, null);
|
||||
public static Part Token(string name, string? format) => new(true, name, format);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Chronos.Core.Naming;
|
||||
|
||||
/// <summary>Default naming templates (BRIEF §7.1).</summary>
|
||||
public static class TemplateDefaults
|
||||
{
|
||||
public const string Folder = "{year}/{date} {camera}";
|
||||
public const string File = "{date}_{time}_{n:0000}";
|
||||
}
|
||||
Reference in new issue
Block a user