protected ProcessExecutor(String[] commandLine) { this.commandLine = commandLine; this.environment = map(); this.redirectErrorStream = false; }
protected ProcessExecutor(String[] commandLine, boolean redirectErrorStream) { this.commandLine = commandLine; this.redirectErrorStream = redirectErrorStream; this.environment = map(); }
protected ProcessExecutor(String commandLine, boolean redirectErrorStream) { this.commandLine = commandLine.split("\\s+"); this.redirectErrorStream = redirectErrorStream; this.environment = map(); }
protected ProcessExecutor(String command, String[] options) { List<String> commandLineList = new ArrayList<String>(); commandLineList.add(command); commandLineList.addAll(Arrays.asList(options)); this.commandLine = commandLineList.toArray(new String[commandLineList.size()]); this.environment = map(); this.redirectErrorStream = false; }
/** * @param values * may be null * @param valueName * the name of the returned {@link MetadataValue} */ private static List<MetadataValue<String>> strings2MetadataValues(final String[] values, final String valueName) { if (values != null) { return map(Arrays.asList(values), new ArrayList<MetadataValue<String>>(), new Function<String, MetadataValue<String>>() { @Override public MetadataValue<String> apply(String s) { return new MetadataValue<String>(s, valueName); } }); } else { return Collections.emptyList(); } }
protected ProcessExecutor(String command, String options) { this.commandLine = mkCommandLine(command, options); this.environment = map(); this.redirectErrorStream = false; }
protected ProcessExecutor(String command, String options, boolean redirectErrorStream) { this.commandLine = mkCommandLine(command, options); this.redirectErrorStream = redirectErrorStream; this.environment = map(); }
/** * Asks the media analyzer to extract the file's metadata. * * @param file * the file * @return the file container metadata * @throws MediaInspectionException * if metadata extraction fails */ private MediaContainerMetadata getFileMetadata(File file, boolean accurateFrameCount) throws MediaInspectionException { if (file == null) throw new IllegalArgumentException("file to analyze cannot be null"); try { MediaAnalyzer analyzer = new FFmpegAnalyzer(accurateFrameCount); analyzer.setConfig(map(Tuple.<String, Object> tuple(FFmpegAnalyzer.FFPROBE_BINARY_CONFIG, ffprobePath))); return analyzer.analyze(file); } catch (MediaAnalyzerException e) { throw new MediaInspectionException(e); } }
/** Check if <code>job</code> is not done yet and wait in case. */ public static JobBarrier.Result waitForJob(Job waiter, ServiceRegistry reg, Option<Long> timeout, Job job) { final Job.Status status = job.getStatus(); // only create a barrier if the job is not done yet switch (status) { case CANCELED: case DELETED: case FAILED: case FINISHED: return new JobBarrier.Result(map(tuple(job, status))); default: for (Long t : timeout) return waitForJobs(waiter, reg, t, job); return waitForJobs(waiter, reg, job); } }