use of org.fagu.fmv.soft.find.SoftInfo in project fmv by f-agu.
the class IMSoftProvider method createSoftExecutor.
/**
* @see org.fagu.fmv.soft.find.SoftProvider#createSoftExecutor(org.fagu.fmv.soft.Soft, java.io.File, java.util.List)
*/
@Override
public SoftExecutor createSoftExecutor(Soft soft, File execFile, List<String> parameters) {
if (SOFT_MAGICK_NAME.equalsIgnoreCase(FilenameUtils.getBaseName(soft.getFile().getName()))) {
SoftInfo softInfo = soft.getFirstInfo();
if (softInfo instanceof VersionSoftInfo) {
VersionSoftInfo versionSoftInfo = (VersionSoftInfo) softInfo;
Optional<Version> version = versionSoftInfo.getVersion();
if (version.isPresent() && version.get().isUpperOrEqualsThan(V7)) {
List<String> newParams = new ArrayList<>(parameters);
newParams.add(0, getName());
return new SoftExecutor(this, execFile, newParams);
}
}
}
return super.createSoftExecutor(soft, execFile, parameters);
}
use of org.fagu.fmv.soft.find.SoftInfo in project fmv by f-agu.
the class SoftInfoContributor method content.
// *********************************************
/**
* @return
*/
private Map<String, String> content() {
Map<String, String> map = new HashMap<>();
for (Soft soft : Softs.getInfoContributors()) {
String msg = null;
if (soft.isFound()) {
StringBuilder buf = new StringBuilder(100);
SoftInfo softInfo = soft.getFirstInfo();
if (softInfo instanceof VersionSoftInfo) {
((VersionSoftInfo) softInfo).getVersion().ifPresent(v -> buf.append(v).append(", "));
}
if (softInfo instanceof VersionDateSoftInfo) {
((VersionDateSoftInfo) softInfo).getDate().ifPresent(d -> {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
buf.append(dateFormat.format(d)).append(", ");
});
}
buf.append(soft.getFile().getAbsolutePath());
msg = buf.toString();
} else {
StringJoiner joiner = new StringJoiner(" ; ");
for (SoftFound softFound : soft.getFounds()) {
StringBuilder buf = new StringBuilder();
FoundReason foundReason = softFound != null ? softFound.getFoundReason() : FoundReasons.NOT_FOUND;
buf.append(foundReason.name());
String reason = softFound.getReason();
if (reason != null) {
buf.append(": ").append(reason);
}
joiner.add(buf.toString());
}
msg = joiner.toString();
}
map.put(soft.getName(), msg);
}
return map;
}
use of org.fagu.fmv.soft.find.SoftInfo in project fmv by f-agu.
the class Soft method toString.
/**
* @return
*/
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append(getName());
if (getFounds().isFound()) {
SoftInfo softInfo = getFirstInfo();
if (softInfo != null) {
String info = softInfo.getInfo();
if (StringUtils.isNotBlank(info)) {
buf.append(' ').append(info);
}
}
buf.append(" (").append(getFile().getAbsolutePath()).append(')');
} else {
buf.append(" <not found>");
}
return buf.toString();
}
use of org.fagu.fmv.soft.find.SoftInfo in project fmv by f-agu.
the class PdfSoftProvider method getDefaultSoftPolicy.
// ***********************************************************************
/**
* @return
*/
private static SoftPolicy getDefaultSoftPolicy() {
Version v012 = new Version(0, 12);
BiPredicate<SoftInfo, Provider> isProvider = (s, p) -> s instanceof XPdfVersionSoftInfo && ((XPdfVersionSoftInfo) s).getProvider() == p;
return new VersionSoftPolicy().on("xpdf", s -> isProvider.test(s, Provider.XPDF), minVersion(Version.V3)).on("poppler", s -> isProvider.test(s, Provider.POPPLER), minVersion(v012)).onAllPlatforms(minVersion(v012));
}
Aggregations