Compare commits

...

7 commits

Author SHA1 Message Date
Malte Rosenbjerg
12f2400092
Merge f31dc2b1cd into 25d7ae8374 2025-09-16 15:02:48 -04:00
Malte Rosenbjerg
25d7ae8374
Merge pull request #572 from WeihanLi/patch-1
docs: update nuget badge
2025-09-09 08:21:05 +02:00
Weihan Li
bbfcfaefac
docs: update nuget badge 2025-07-21 17:08:22 +08:00
Malte Rosenbjerg
f31dc2b1cd
Merge branch 'main' into bugfix/ensure-ffmpeg-not-found-throws-ffmpegexception 2024-12-04 20:58:27 +01:00
Malte Rosenbjerg
d43ea98e0e
Merge branch 'main' into bugfix/ensure-ffmpeg-not-found-throws-ffmpegexception 2024-12-04 20:55:04 +01:00
Malte Rosenbjerg
508cce8827 Change test path to non-existing directory 2023-02-23 22:00:19 +01:00
Malte Rosenbjerg
349b6044d1 Wrap Instances exception for expected behaviour 2023-02-23 19:18:34 +01:00
3 changed files with 21 additions and 3 deletions

View file

@ -1,6 +1,9 @@
using System.Reflection; using System.Reflection;
using FFMpegCore.Arguments; using FFMpegCore.Arguments;
using FFMpegCore.Exceptions;
using FFMpegCore.Helpers;
using FluentAssertions; using FluentAssertions;
using Instances.Exceptions;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FFMpegCore.Test namespace FFMpegCore.Test
@ -99,5 +102,12 @@ namespace FFMpegCore.Test
var arg = new AudibleEncryptionKeyArgument("62689101"); var arg = new AudibleEncryptionKeyArgument("62689101");
arg.Text.Should().Be($"-activation_bytes 62689101"); arg.Text.Should().Be($"-activation_bytes 62689101");
} }
[TestMethod]
public void Throws_FFMpegException_when_ffmpeg_not_found()
{
var exception = Assert.ThrowsException<FFMpegException>(() => FFMpegHelper.VerifyFFMpegExists(new FFOptions { BinaryFolder = "./folder/that/does/not/exist" }));
Assert.IsInstanceOfType<InstanceFileNotFoundException>(exception.InnerException);
}
} }
} }

View file

@ -42,8 +42,16 @@ namespace FFMpegCore.Helpers
return; return;
} }
try
{
var result = Instance.Finish(GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), "-version"); var result = Instance.Finish(GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), "-version");
_ffmpegVerified = result.ExitCode == 0; _ffmpegVerified = result.ExitCode == 0;
}
catch (Exception e)
{
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system", e);
}
if (!_ffmpegVerified) if (!_ffmpegVerified)
{ {
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system"); throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system");

View file

@ -1,5 +1,5 @@
# [FFMpegCore](https://www.nuget.org/packages/FFMpegCore/) # [FFMpegCore](https://www.nuget.org/packages/FFMpegCore/)
[![NuGet Badge](https://buildstats.info/nuget/FFMpegCore)](https://www.nuget.org/packages/FFMpegCore/) [![NuGet Version](https://img.shields.io/nuget/v/FFMpegCore)](https://www.nuget.org/packages/FFMpegCore/)
[![GitHub issues](https://img.shields.io/github/issues/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/issues) [![GitHub issues](https://img.shields.io/github/issues/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/issues)
[![GitHub stars](https://img.shields.io/github/stars/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/stargazers) [![GitHub stars](https://img.shields.io/github/stars/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/stargazers)
[![GitHub](https://img.shields.io/github/license/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/blob/master/LICENSE) [![GitHub](https://img.shields.io/github/license/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/blob/master/LICENSE)