Init V4 community edition (#2265)

* Init V4 community edition

* Init V4 community edition
This commit is contained in:
AaronLiu
2025-04-20 17:31:25 +08:00
committed by GitHub
parent da4e44b77a
commit 21d158db07
597 changed files with 119415 additions and 41692 deletions

View File

@@ -23,13 +23,28 @@ func TestGenerator(ctx context.Context, name, executable string) (string, error)
return testFfmpegGenerator(ctx, executable)
case "libreOffice":
return testLibreOfficeGenerator(ctx, executable)
case "libRaw":
return testLibRawGenerator(ctx, executable)
case "ffprobe":
return testFFProbeGenerator(ctx, executable)
default:
return "", ErrUnknownGenerator
}
}
func testFFProbeGenerator(ctx context.Context, executable string) (string, error) {
cmd := exec.CommandContext(ctx, executable, "-version")
var output bytes.Buffer
cmd.Stdout = &output
if err := cmd.Run(); err != nil {
return "", fmt.Errorf("failed to invoke ffmpeg executable: %w", err)
}
if !strings.Contains(output.String(), "ffprobe") {
return "", ErrUnknownOutput
}
return output.String(), nil
}
func testVipsGenerator(ctx context.Context, executable string) (string, error) {
cmd := exec.CommandContext(ctx, executable, "--version")
var output bytes.Buffer
@@ -74,18 +89,3 @@ func testLibreOfficeGenerator(ctx context.Context, executable string) (string, e
return output.String(), nil
}
func testLibRawGenerator(ctx context.Context, executable string) (string, error) {
cmd := exec.CommandContext(ctx, executable)
var output bytes.Buffer
cmd.Stdout = &output
if err := cmd.Run(); err != nil {
return "", fmt.Errorf("failed to invoke libraw executable: %w", err)
}
if !strings.Contains(output.String(), "LibRaw") {
return "", ErrUnknownOutput
}
return output.String(), nil
}