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: @@ -182,7 +182,7 @@ jobs:
id: downloadffmpeg
name: Download ffmpeg
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/
- name: Build

1
CHANGELOG.md

@ -83,6 +83,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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
- Add `ETV_MAXIMUM_UPLOAD_MB` environment variable to allow uploading large watermarks
- Default value is 10
- Update ffmpeg health check to link to ErsatzTV-FFmpeg release that contains binaries for win64, linux64, linuxarm64
### Changed
- 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 @@ -21,6 +21,9 @@ public abstract class BaseHealthCheck
protected HealthCheckResult FailResult(string message, string briefMessage) =>
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) =>
new(Title, HealthCheckStatus.Warning, message, briefMessage, None);

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

@ -23,18 +23,20 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe @@ -23,18 +23,20 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
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 =
await _configElementRepository.GetConfigElement(ConfigElementKey.FFmpegPath);
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 =
await _configElementRepository.GetConfigElement(ConfigElementKey.FFprobePath);
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)
@ -42,12 +44,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe @@ -42,12 +44,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
Option<string> maybeVersion = await GetVersion(ffmpegPath.Value, cancellationToken);
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 (HealthCheckResult result in ValidateVersion(version, "ffmpeg"))
foreach (HealthCheckResult result in ValidateVersion(version, "ffmpeg", link))
{
return result;
}
@ -59,12 +61,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe @@ -59,12 +61,12 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
Option<string> maybeVersion = await GetVersion(ffprobePath.Value, cancellationToken);
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 (HealthCheckResult result in ValidateVersion(version, "ffprobe"))
foreach (HealthCheckResult result in ValidateVersion(version, "ffprobe", link))
{
return result;
}
@ -74,14 +76,14 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe @@ -74,14 +76,14 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
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) ||
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");
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) &&
@ -90,7 +92,7 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe @@ -90,7 +92,7 @@ public class FFmpegVersionHealthCheck : BaseHealthCheck, IFFmpegVersionHealthChe
version != BundledVersionVaapi)
{
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;

Loading…
Cancel
Save