private ImageInfoExtended getInfo(String inputFilePath) throws CommandNotAvailable, CommandException { ExecResult result = getIdentifyResult(inputFilePath); if (!result.isSuccessful()) { log.debug("identify failed for file: " + inputFilePath); throw result.getError(); } String out = result.getOutput().get(result.getOutput().size() > 1 ? result.getOutput().size() - 1 : 0); String[] res = out.split(" "); return new ImageInfoExtended(res[1], res[2], res[0], res[3], res[4], res[5], inputFilePath); }
protected Map<String, Object> returnResultMap(ExecResult er) throws IOException { if (!er.isSuccessful()) { throw new BinaryMetadataException( "There was an error executing " + "the following command: " + er.getCommandLine(), er.getError()); } StringBuilder sb = new StringBuilder(); for (String line : er.getOutput()) { sb.append(line); } String jsonOutput = sb.toString(); List<Map<String, Object>> resultList = jacksonMapper.readValue(jsonOutput, new TypeReference<List<HashMap<String, Object>>>() { }); Map<String, Object> resultMap = resultList.get(0); // Remove the SourceFile metadata injected automatically by ExifTool. resultMap.remove(META_NON_USED_SOURCE_FILE); parseDates(resultMap); return resultMap; }
public static void convert(String inputFilePath, String outputFilePath) throws CommandNotAvailable, CommandException { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("inputFilePath", inputFilePath); params.addNamedParameter("outputFilePath", outputFilePath); ExecResult res = cles.execCommand("converter", params); if (!res.isSuccessful()) { throw res.getError(); } }
tool.cleanupInputs(params); if (clResult.getError() != null) { throw new NuxeoException("Failed to execute the command <" + commandLineName + ">", clResult.getError()); if (!clResult.isSuccessful()) { throw new NuxeoException("Failed to execute the command <" + commandLineName + ">. Final command [ " + clResult.getCommandLine() + " ] returned with error " + clResult.getReturnCode());
params.addNamedParameter("tagList", getCommandTags(metadata)); ExecResult er = commandLineService.execCommand(command, params); boolean success = er.isSuccessful(); if (!success) { log.error("There was an error executing " + "the following command: " + er.getCommandLine() + ". \n" + er.getOutput()); return null;
return new ExecResult(null, output, 0, returnCode);
public static void rotate(String inputFile, String outputFile, int angle) throws CommandNotAvailable, CommandException { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("angle", String.valueOf(angle)); params.addNamedParameter("inputFilePath", inputFile); params.addNamedParameter("outputFilePath", outputFile); ExecResult result = cles.execCommand("rotate", params); if (!result.isSuccessful()) { throw result.getError(); } }
public static ImageInfo getInfo(String inputFilePath) throws CommandNotAvailable, CommandException { ExecResult result = getIdentifyResult(inputFilePath); if (!result.isSuccessful()) { log.debug("identify failed for file: " + inputFilePath); throw result.getError(); } String out = result.getOutput().get(result.getOutput().size() > 1 ? result.getOutput().size() - 1 : 0); String[] res = out.split(" "); return new ImageInfo(res[1], res[2], res[0], res[3], res[4], inputFilePath); }
public static void crop(String inputFilePath, String outputFilePath, int tileWidth, int tileHeight, int offsetX, int offsetY) throws CommandNotAvailable, CommandException { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("tileWidth", String.valueOf(tileWidth)); params.addNamedParameter("tileHeight", String.valueOf(tileHeight)); params.addNamedParameter("offsetX", String.valueOf(offsetX)); params.addNamedParameter("offsetY", String.valueOf(offsetY)); params.addNamedParameter("inputFilePath", inputFilePath); params.addNamedParameter("outputFilePath", outputFilePath); ExecResult res = cles.execCommand("crop", params); if (!res.isSuccessful()) { throw res.getError(); } }
if (!result.isSuccessful()) { throw result.getError(); return new TTCCmdReturn(params, result.getOutput()); } catch (final CommandNotAvailable e) {
/** @since 5.9.5. */ public static void cropAndResize(String inputFilePath, String outputFilePath, int tileWidth, int tileHeight, int offsetX, int offsetY, int targetWidth, int targetHeight, String mapComponents) throws CommandNotAvailable, CommandException { if (mapComponents == null) { mapComponents = DEFAULT_MAP_COMPONENTS; } CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("tileWidth", String.valueOf(tileWidth)); params.addNamedParameter("tileHeight", String.valueOf(tileHeight)); params.addNamedParameter("offsetX", String.valueOf(offsetX)); params.addNamedParameter("offsetY", String.valueOf(offsetY)); params.addNamedParameter("targetWidth", String.valueOf(targetWidth)); params.addNamedParameter("targetHeight", String.valueOf(targetHeight)); params.addNamedParameter("inputFilePath", inputFilePath); params.addNamedParameter("outputFilePath", outputFilePath); params.addNamedParameter("mapComponents", mapComponents); ExecResult res = cles.execCommand("cropAndResize", params); if (!res.isSuccessful()) { throw res.getError(); } }
public static VideoInfo getVideoInfo(Blob video) { if (video == null || video.getLength() == 0) { return null; } try { ExecResult result; try (CloseableFile cf = video.getCloseableFile("." + FilenameUtils.getExtension(video.getFilename()))) { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("inFilePath", cf.getFile().getAbsolutePath()); // read the duration with a first command to adjust the best rate: result = cles.execCommand(FFMPEG_INFO_COMMAND_LINE, params); } if (!result.isSuccessful()) { throw result.getError(); } return VideoInfo.fromFFmpegOutput(result.getOutput()); } catch (CommandNotAvailable | CommandException | IOException e) { throw new NuxeoException(e); } }
if (!res.isSuccessful()) { throw res.getError();
params.addNamedParameter("targetDepth", String.valueOf(info.getDepth())); ExecResult res = execCommand(commandName, params); if (!res.isSuccessful()) { throw res.getError();
if (!res.isSuccessful()) { throw res.getError();