Browse Source

link ffmpeg health check to ersatztv-ffmpeg release (#2154)

* link ffmpeg health check to ersatztv-ffmpeg release

* bump windows ffmpeg to use the same version as linux
pull/2157/head
Jason Dove 1 month ago committed by GitHub
parent
commit
848b88bd2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/artifacts.yml
  2. 1
      CHANGELOG.md
  3. 3
      ErsatzTV.Infrastructure/Health/Checks/BaseHealthCheck.cs
  4. 20
      ErsatzTV.Infrastructure/Health/Checks/FFmpegVersionHealthCheck.cs

2
.github/workflows/artifacts.yml

@ -182,7 +182,7 @@ jobs:
id: downloadffmpeg id: downloadffmpeg
name: Download ffmpeg name: Download ffmpeg
with: with:
url: "https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/download/7.1.1/ffmpeg-n7.1.1-22-g0f1fe3d153-win64-gpl-7.1.zip" url: "https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/download/7.1.1/ffmpeg-n7.1.1-56-gc2184b65d2-win64-gpl-7.1.zip"
target: ffmpeg/ target: ffmpeg/
- name: Build - name: Build

1
CHANGELOG.md

@ -83,6 +83,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Block items that have this checked will never display a watermark, even with Deco set to override watermark - Block items that have this checked will never display a watermark, even with Deco set to override watermark
- Add `ETV_MAXIMUM_UPLOAD_MB` environment variable to allow uploading large watermarks - Add `ETV_MAXIMUM_UPLOAD_MB` environment variable to allow uploading large watermarks
- Default value is 10 - Default value is 10
- Update ffmpeg health check to link to ErsatzTV-FFmpeg release that contains binaries for win64, linux64, linuxarm64
### Changed ### Changed
- Allow `Other Video` libraries and `Image` libraries to use the same folders - Allow `Other Video` libraries and `Image` libraries to use the same folders

3
ErsatzTV.Infrastructure/Health/Checks/BaseHealthCheck.cs

@ -21,6 +21,9 @@ public abstract class BaseHealthCheck
protected HealthCheckResult FailResult(string message, string briefMessage) => protected HealthCheckResult FailResult(string message, string briefMessage) =>
new(Title, HealthCheckStatus.Fail, message, briefMessage, None); new(Title, HealthCheckStatus.Fail, message, briefMessage, None);
protected HealthCheckResult FailResult(string message, string briefMessage, HealthCheckLink link) =>
new(Title, HealthCheckStatus.Fail, message, briefMessage, link);
protected HealthCheckResult WarningResult(string message, string briefMessage) => protected HealthCheckResult WarningResult(string message, string briefMessage) =>
new(Title, HealthCheckStatus.Warning, message, briefMessage, None); new(Title, HealthCheckStatus.Warning, message, briefMessage, None);

20
ErsatzTV.Infrastructure/Health/Checks/FFmpegVersionHealthCheck.cs

@ -23,18 +23,20 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
public async Task<HealthCheckResult> Check(CancellationToken cancellationToken) public async Task<HealthCheckResult> Check(CancellationToken cancellationToken)
{ {
var link = new HealthCheckLink("https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/tag/7.1.1");
Option<ConfigElement> maybeFFmpegPath = Option<ConfigElement> maybeFFmpegPath =
await _configElementRepository.GetConfigElement(ConfigElementKey.FFmpegPath); await _configElementRepository.GetConfigElement(ConfigElementKey.FFmpegPath);
if (maybeFFmpegPath.IsNone) if (maybeFFmpegPath.IsNone)
{ {
return FailResult("Unable to locate ffmpeg", "Unable to locate ffmpeg"); return FailResult("Unable to locate ffmpeg", "Unable to locate ffmpeg", link);
} }
Option<ConfigElement> maybeFFprobePath = Option<ConfigElement> maybeFFprobePath =
await _configElementRepository.GetConfigElement(ConfigElementKey.FFprobePath); await _configElementRepository.GetConfigElement(ConfigElementKey.FFprobePath);
if (maybeFFprobePath.IsNone) if (maybeFFprobePath.IsNone)
{ {
return FailResult("Unable to locate ffprobe", "Unable to locate ffprobe"); return FailResult("Unable to locate ffprobe", "Unable to locate ffprobe", link);
} }
foreach (ConfigElement ffmpegPath in maybeFFmpegPath) foreach (ConfigElement ffmpegPath in maybeFFmpegPath)
@ -42,12 +44,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
Option<string> maybeVersion = await GetVersion(ffmpegPath.Value, cancellationToken); Option<string> maybeVersion = await GetVersion(ffmpegPath.Value, cancellationToken);
if (maybeVersion.IsNone) if (maybeVersion.IsNone)
{ {
return WarningResult("Unable to determine ffmpeg version", "Unable to determine ffmpeg version"); return WarningResult("Unable to determine ffmpeg version", "Unable to determine ffmpeg version", link);
} }
foreach (string version in maybeVersion) foreach (string version in maybeVersion)
{ {
foreach (HealthCheckResult result in ValidateVersion(version, "ffmpeg")) foreach (HealthCheckResult result in ValidateVersion(version, "ffmpeg", link))
{ {
return result; return result;
} }
@ -59,12 +61,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
Option<string> maybeVersion = await GetVersion(ffprobePath.Value, cancellationToken); Option<string> maybeVersion = await GetVersion(ffprobePath.Value, cancellationToken);
if (maybeVersion.IsNone) if (maybeVersion.IsNone)
{ {
return WarningResult("Unable to determine ffprobe version", "Unable to determine ffprobe version"); return WarningResult("Unable to determine ffprobe version", "Unable to determine ffprobe version", link);
} }
foreach (string version in maybeVersion) foreach (string version in maybeVersion)
{ {
foreach (HealthCheckResult result in ValidateVersion(version, "ffprobe")) foreach (HealthCheckResult result in ValidateVersion(version, "ffprobe", link))
{ {
return result; return result;
} }
@ -74,14 +76,14 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
return new HealthCheckResult("FFmpeg Version", HealthCheckStatus.Pass, string.Empty, string.Empty, None); return new HealthCheckResult("FFmpeg Version", HealthCheckStatus.Pass, string.Empty, string.Empty, None);
} }
private Option<HealthCheckResult> ValidateVersion(string version, string app) private Option<HealthCheckResult> ValidateVersion(string version, string app, HealthCheckLink link)
{ {
if (version.StartsWith("3.", StringComparison.OrdinalIgnoreCase) || if (version.StartsWith("3.", StringComparison.OrdinalIgnoreCase) ||
version.StartsWith("4.", StringComparison.OrdinalIgnoreCase) || version.StartsWith("4.", StringComparison.OrdinalIgnoreCase) ||
version.StartsWith("5.", StringComparison.OrdinalIgnoreCase) || version.StartsWith("5.", StringComparison.OrdinalIgnoreCase) ||
version.StartsWith("6.", 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"); 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) && if (!version.StartsWith("7.1.1", StringComparison.OrdinalIgnoreCase) &&
@ -90,7 +92,7 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
version != BundledVersionVaapi) version != BundledVersionVaapi)
{ {
return WarningResult( return WarningResult(
$"{app} version {version} is unexpected and may have problems; please install 7.1.1!", $"{app} version is unexpected"); $"{app} version {version} is unexpected and may have problems; please install 7.1.1!", $"{app} version is unexpected", link);
} }
return None; return None;

Loading…
Cancel
Save