mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Merge branch 'master' into MetaDataArgument
This commit is contained in:
commit
48689cf694
2 changed files with 18 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using FFMpegCore.Arguments;
|
||||||
|
|
||||||
namespace FFMpegCore.Test
|
namespace FFMpegCore.Test
|
||||||
{
|
{
|
||||||
|
@ -86,5 +87,12 @@ FFMpegArgumentProcessor CreateArgumentProcessor() => FFMpegArguments
|
||||||
var options2 = processor2.GetConfiguredOptions(null);
|
var options2 = processor2.GetConfiguredOptions(null);
|
||||||
options2.WorkingDirectory.Should().Be(globalWorkingDir);
|
options2.WorkingDirectory.Should().Be(globalWorkingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void Concat_Escape()
|
||||||
|
{
|
||||||
|
var arg = new DemuxConcatArgument(new[] { @"Heaven's River\05 - Investigation.m4b" });
|
||||||
|
arg.Values.Should().BeEquivalentTo(new[] { @"file 'Heaven'\''s River\05 - Investigation.m4b'" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,8 +16,17 @@ public class DemuxConcatArgument : IInputArgument
|
||||||
public readonly IEnumerable<string> Values;
|
public readonly IEnumerable<string> Values;
|
||||||
public DemuxConcatArgument(IEnumerable<string> values)
|
public DemuxConcatArgument(IEnumerable<string> values)
|
||||||
{
|
{
|
||||||
Values = values.Select(value => $"file '{value}'");
|
Values = values.Select(value => $"file '{Escape(value)}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thanks slhck
|
||||||
|
/// https://superuser.com/a/787651/1089628
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string Escape(string value) => value.Replace("'", @"'\''");
|
||||||
|
|
||||||
private readonly string _tempFileName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, $"concat_{Guid.NewGuid()}.txt");
|
private readonly string _tempFileName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, $"concat_{Guid.NewGuid()}.txt");
|
||||||
|
|
||||||
public void Pre() => File.WriteAllLines(_tempFileName, Values);
|
public void Pre() => File.WriteAllLines(_tempFileName, Values);
|
||||||
|
|
Loading…
Reference in a new issue