603af17e56
The repo carried two parallel UIs (WPF + WinUI) sharing Models/Services via
cross-directory Link includes. Now that WinUI is the only frontend, collapse
the structure so the WinUI project IS the repo root instead of a nested
sibling folder:
- Delete the WPF project entirely (App.xaml, MainWindow.xaml, csproj) and its
bin/obj output
- Move AmiReel.WinUI/* up to the repo root (App, MainWindow, MainPage,
DialogHelper, Assets, Package.appxmanifest, app.manifest, Properties,
.github/instructions, AGENTS.md) via git mv, preserving history
- Rename AmiReel.WinUI.csproj -> AmiReel.csproj; regenerate the solution as
AmiReel.slnx (the newer XML solution format) with a single project
- Rename namespace AmigaDB.VideoRenderer.{Models,Services} -> AmiReel.{...}
and AmiReel_WinUI -> AmiReel across all files, including the embedded
ffmpeg/ffprobe resource logical names in the csproj and ToolExtractor
- Models/ and Services/ no longer need the Link-based cross-directory
<Compile Include>; they're picked up by the SDK's default globbing now
that they live under the project directory
- Rename assets/ -> branding/ (source icon art) to avoid a case-insensitive
collision with Assets/ (packaged tile art) once both sit at repo root
- Merge the two .gitignore files into one; track the PublishProfiles pubxml
files instead of ignoring them (no secrets, and they keep publish
reproducible across machines) as branding, gitignore, etc.
- Simplify publish-win-x64.ps1 (drop the -Target Wpf/WinUI switch, there's
only one target now) and rewrite README.md to describe the single-project
layout, build/run/publish commands, and file structure
Verified: dotnet build succeeds for both AmiReel.csproj and AmiReel.slnx, and
the built exe launches and renders identically to before the move.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Globalization;
|
|
using System.IO;
|
|
|
|
namespace AmiReel.Services;
|
|
|
|
internal sealed class MediaProbe
|
|
{
|
|
private readonly ProcessRunner _runner;
|
|
private readonly Action<string>? _log;
|
|
|
|
public MediaProbe(ProcessRunner runner, Action<string>? log)
|
|
{
|
|
_runner = runner;
|
|
_log = log;
|
|
}
|
|
|
|
public async Task<double> ProbeDurationAsync(ToolPaths tools, string input, CancellationToken token)
|
|
{
|
|
using FfmpegLibraryProbe? libraryProbe = CreateLibraryProbe(tools);
|
|
if (libraryProbe is not null)
|
|
return libraryProbe.ProbeDuration(input);
|
|
|
|
string output = await _runner.RunAsync(tools.Ffprobe,
|
|
["-v", "error", "-show_entries", "format=duration", "-of", "default=nk=1:nw=1", input],
|
|
null, null, token);
|
|
return double.Parse(output.Trim(), CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
public async Task<bool> HasAudioAsync(ToolPaths tools, string input, CancellationToken token)
|
|
{
|
|
using FfmpegLibraryProbe? libraryProbe = CreateLibraryProbe(tools);
|
|
if (libraryProbe is not null)
|
|
return libraryProbe.HasAudio(input);
|
|
|
|
string output = await _runner.RunAsync(tools.Ffprobe,
|
|
["-v", "error", "-select_streams", "a", "-show_entries", "stream=index", "-of", "csv=p=0", input],
|
|
null, null, token);
|
|
return !string.IsNullOrWhiteSpace(output);
|
|
}
|
|
|
|
private FfmpegLibraryProbe? CreateLibraryProbe(ToolPaths tools)
|
|
{
|
|
if (!FfmpegLibraryProbe.TryCreate(tools.Ffmpeg, out FfmpegLibraryProbe? probe))
|
|
return null;
|
|
|
|
_log?.Invoke($"Using FFmpeg shared libraries for media probing from '{Path.GetDirectoryName(tools.Ffmpeg)}'.");
|
|
return probe;
|
|
}
|
|
}
|