use of org.fagu.fmv.soft.find.SoftFoundFactory in project fmv by f-agu.
the class SoftTestCase method test1.
@Test
@Ignore
public void test1() throws Exception {
SoftFoundFactory ffSoftFoundFactory = ExecSoftFoundFactory.forProvider(new TestSoftProvider("ffprout")).withParameters("-version").parseFactory((file, softPolicy) -> new Parser() {
private Integer build;
@Override
public void readLine(String line) {
if (line.startsWith("ff")) {
build = Integer.parseInt(StringUtils.substringBetween(line, "N-", "-"));
}
}
@Override
public SoftFound closeAndParse(String cmdLineStr, int exitValue) throws IOException {
if (build == null) {
return SoftFound.foundBadSoft(file);
}
// return SoftFound.found(file, new TestSoftInfo(build));
return SoftFound.foundBadVersion(new TestSoftInfo(49), "85");
}
}).build();
// SoftFoundFactory identifyFoundFactory = ExecSoftFoundFactory.withParameters("-version").parseFactory(file ->
// new Parser() {
//
// @Override
// public void readLine(String line) {}
//
// @Override
// public SoftFound closeAndParse(String cmdLineStr, int exitValue) throws IOException {
// return SoftFound.foundBadVersion(new TestSoftInfo(49), "85");
// }
// }).build();
Soft soft = Soft.with(new TestSoftProvider("ffprout")).search(ffSoftFoundFactory);
// Soft ffprobeSoft = Soft.with("ffprobe").search(ffSoftFoundFactory);
// Soft identifySoft = Soft.withName("identify").search(identifyFoundFactory);
SoftLogger softFormatter = new SoftLogger(Arrays.asList(soft));
// SoftLogger softFormatter = new SoftLogger(Arrays.asList(ffprobeSoft, identifySoft, ffmpegSoft));
softFormatter.logDetails(System.out::println);
// System.out.println(soft.getFounds());
// System.out.println(soft.getFile());
soft.withParameters("").execute();
}
Aggregations