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); }
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); }
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; }
throw result.getError(); return new TTCCmdReturn(params, result.getOutput()); } catch (final CommandNotAvailable e) {
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 (!success) { log.error("There was an error executing " + "the following command: " + er.getCommandLine() + ". \n" + er.getOutput()); return null;