Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 5s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 8s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 54s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 5m48s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 12m49s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 14m35s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 18m11s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 13m23s
Make the ~14 health checks actionable: each check that has a fix now declares
where to go, and the SPA acts on it.
Backend:
- Widen domain HealthCheckLink (string Link) -> (string Target, HealthCheckLinkKind
Kind) with ExternalDoc|AppRoute + factories; only the 4 link-building checks and
the API mapper touched .Link.
- Evolve HealthCheckResponseModel additively (/api/v1 frozen-additive): keep
deprecated string? Link (still populated), add Brief (the BriefMessage the mapper
was silently dropping) and nested Remediation {Kind, Target}. Kind is a mapped
string, not a wire enum.
- Make Mapper.GetStatus total: NotApplicable no longer throws (defensive; handler
still filters it). InternalsVisibleTo(ErsatzTV.Tests) added to unit-test totality.
- Fix 2 stale Blazor route links (media/trash -> /app/trash, search?query ->
/app/search); add AppRoute remediation to actionable checks that had none
(libraries / schedules / ffmpeg-profiles / settings).
SPA:
- DashboardScreen health panel renders remediation: AppRoute -> client-side nav
button, ExternalDoc -> new-tab anchor; detail text truncates with title-hover.
- Remove the dead "Open Classic UI" -> /system/health row from SettingsScreen
(a #91b leftover that just 302'd to /app); update its regression test.
Docs: decisions.md (#164), api-conventions.md (deprecate-in-place DTO evolution),
blazor-route-parity.md (Section 4 correction); v1.json/v1.d.ts/endpoint-index
regenerated.
fixes #164
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
107 lines
4.1 KiB
C#
107 lines
4.1 KiB
C#
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.Core.Health;
|
|
using ErsatzTV.Core.Health.Checks;
|
|
using ErsatzTV.Core.Interfaces.Repositories;
|
|
using ErsatzTV.FFmpeg.Capabilities;
|
|
|
|
namespace ErsatzTV.Infrastructure.Health.Checks;
|
|
|
|
public class FFmpegVersionHealthCheck(
|
|
IConfigElementRepository configElementRepository,
|
|
IHardwareCapabilitiesFactory hardwareCapabilitiesFactory)
|
|
: BaseHealthCheck, IFFmpegVersionHealthCheck
|
|
{
|
|
private const string BundledVersion = "7.1.1";
|
|
private const string BundledVersionVaapi = "7.1.1";
|
|
private const string WindowsVersionPrefix = "n7.1.1";
|
|
|
|
public override string Title => "FFmpeg Version";
|
|
|
|
public async Task<HealthCheckResult> Check(CancellationToken cancellationToken)
|
|
{
|
|
var link = HealthCheckLink.ExternalDoc("https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/tag/7.1.1");
|
|
|
|
Option<ConfigElement> maybeFFmpegPath =
|
|
await configElementRepository.GetConfigElement(ConfigElementKey.FFmpegPath, cancellationToken);
|
|
if (maybeFFmpegPath.IsNone)
|
|
{
|
|
return FailResult("Unable to locate ffmpeg", "Unable to locate ffmpeg", link);
|
|
}
|
|
|
|
Option<ConfigElement> maybeFFprobePath =
|
|
await configElementRepository.GetConfigElement(ConfigElementKey.FFprobePath, cancellationToken);
|
|
if (maybeFFprobePath.IsNone)
|
|
{
|
|
return FailResult("Unable to locate ffprobe", "Unable to locate ffprobe", link);
|
|
}
|
|
|
|
foreach (ConfigElement ffmpegPath in maybeFFmpegPath)
|
|
{
|
|
Option<string> maybeVersion =
|
|
await hardwareCapabilitiesFactory.GetFFmpegVersion(ffmpegPath.Value, cancellationToken);
|
|
if (maybeVersion.IsNone || maybeVersion.Exists(string.IsNullOrWhiteSpace))
|
|
{
|
|
return WarningResult("Unable to determine ffmpeg version", "Unable to determine ffmpeg version", link);
|
|
}
|
|
|
|
foreach (string version in maybeVersion)
|
|
{
|
|
foreach (HealthCheckResult result in ValidateVersion(version, "ffmpeg", link))
|
|
{
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (ConfigElement ffprobePath in maybeFFprobePath)
|
|
{
|
|
Option<string> maybeVersion =
|
|
await hardwareCapabilitiesFactory.GetFFmpegVersion(ffprobePath.Value, cancellationToken);
|
|
if (maybeVersion.IsNone || maybeVersion.Exists(string.IsNullOrWhiteSpace))
|
|
{
|
|
return WarningResult(
|
|
"Unable to determine ffprobe version",
|
|
"Unable to determine ffprobe version",
|
|
link);
|
|
}
|
|
|
|
foreach (string version in maybeVersion)
|
|
{
|
|
foreach (HealthCheckResult result in ValidateVersion(version, "ffprobe", link))
|
|
{
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
return new HealthCheckResult("FFmpeg Version", HealthCheckStatus.Pass, string.Empty, string.Empty, None);
|
|
}
|
|
|
|
private Option<HealthCheckResult> ValidateVersion(string version, string app, HealthCheckLink link)
|
|
{
|
|
if (version.StartsWith("3.", StringComparison.OrdinalIgnoreCase) ||
|
|
version.StartsWith("4.", StringComparison.OrdinalIgnoreCase) ||
|
|
version.StartsWith("5.", StringComparison.OrdinalIgnoreCase) ||
|
|
version.StartsWith("6.", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return FailResult(
|
|
$"{app} version {version} is too old; please install 7.1.1!",
|
|
$"{app} version is too old",
|
|
link);
|
|
}
|
|
|
|
if (!version.StartsWith("7.1.1", StringComparison.OrdinalIgnoreCase) &&
|
|
!version.StartsWith(WindowsVersionPrefix, StringComparison.OrdinalIgnoreCase) &&
|
|
version != BundledVersion &&
|
|
version != BundledVersionVaapi)
|
|
{
|
|
return WarningResult(
|
|
$"{app} version {version} is unexpected and may have problems; please install 7.1.1!",
|
|
$"{app} version is unexpected",
|
|
link);
|
|
}
|
|
|
|
return None;
|
|
}
|
|
}
|