Titano: time-lapse ecosystem (client, server, uploader) — in progress #1

Merged
Alby96 merged 204 commits from claude/keen-knuth-uhxv8w into main 2026-10-02 16:29:53 +02:00
2 changed files with 23 additions and 0 deletions
Showing only changes of commit 15fe092614 - Show all commits

No files matched your search

+11
View File
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Text;
using Titano.Core.Naming;
using Titano.Core.Project;
using Titano.Core.Video;
namespace Titano.Core.Export;
@@ -114,6 +115,16 @@ public static class ExportNaming
return Unique(folder, name, extension);
}
/// <summary>
/// Output path of a project's export: <see cref="ExportSettings.Folder"/> or, when unset, the sequence's exports folder,
/// named by <see cref="ExportSettings.NameTemplate"/>.
/// </summary>
public static string OutputPath(ExportSettings settings, string sequenceExportsFolder, ExportNameContext context)
{
ArgumentNullException.ThrowIfNull(settings);
return OutputPath(string.IsNullOrWhiteSpace(settings.Folder) ? sequenceExportsFolder : settings.Folder, settings.NameTemplate, context);
}
/// <summary>"name.ext", or "name (2).ext", "name (3).ext"… when a file or folder of that name exists.</summary>
public static string Unique(string folder, string name, string extension)
{
@@ -1,4 +1,5 @@
using Titano.Core.Export;
using Titano.Core.Project;
using Titano.Core.Video;
using Titano.Testing;
@@ -68,4 +69,15 @@ public sealed class ExportNamingTests
Assert.Equal(Path.Combine(dir, "Harbour sunset (2)"), ExportNaming.OutputPath(dir, "{title}", Context(VideoCodec.PngSequence)));
Assert.Equal(Path.Combine(dir, "Harbour sunset.gif"), ExportNaming.OutputPath(dir, "{title}", Context(VideoCodec.Gif)));
}
[Test]
public void ProjectSettingsChooseFolderAndTemplate()
{
var exports = _context.CreateTempDirectory("exports");
var custom = _context.CreateTempDirectory("custom");
var byDefault = ExportNaming.OutputPath(new ExportSettings(), exports, Context());
Assert.Equal(Path.Combine(exports, "2024-06-21 Harbour sunset - 4K UHD HEVC.mp4"), byDefault);
var chosen = ExportNaming.OutputPath(new ExportSettings { Folder = custom, NameTemplate = "{title} {width}" }, exports, Context());
Assert.Equal(Path.Combine(custom, "Harbour sunset 3840.mp4"), chosen);
}
}