Example usage for org.apache.commons.exec CommandLine setSubstitutionMap

List of usage examples for org.apache.commons.exec CommandLine setSubstitutionMap

Introduction

In this page you can find the example usage for org.apache.commons.exec CommandLine setSubstitutionMap.

Prototype

public void setSubstitutionMap(final Map<String, ?> substitutionMap) 

Source Link

Document

Set the substitutionMap to expand variables in the command line.

Usage

From source file:org.silverpeas.media.video.ffmpeg.FFmpegUtil.java

static CommandLine buildFFmpegThumbnailExtractorCommandLine(File inputFile, File outputFile, int seconds) {
    Map<String, File> files = new HashMap<String, File>(2);
    files.put("inputFile", inputFile);
    files.put("outputFile", outputFile);
    CommandLine commandLine = new CommandLine("ffmpeg");
    // Time of extract in seconds
    commandLine.addArgument("-ss", false);
    commandLine.addArgument(Integer.toString(seconds), false);
    commandLine.addArgument("-i", false);
    commandLine.addArgument("${inputFile}", false);
    // Only one frame
    commandLine.addArgument("-vframes", false);
    commandLine.addArgument("1", false);
    // Resize/scale of output picture keeping aspect ratio
    commandLine.addArgument("-vf", false);
    commandLine.addArgument("scale=600:-1", false);
    commandLine.addArgument("${outputFile}", false);
    commandLine.setSubstitutionMap(files);
    return commandLine;
}

From source file:org.silverpeas.viewer.util.SwfUtil.java

static CommandLine buildPdfToSwfCommandLine(final String endingCommand, File inputFile, File outputFile) {
    Map<String, File> files = new HashMap<String, File>(2);
    files.put("inputFile", inputFile);
    files.put("outputFile", outputFile);
    CommandLine commandLine = new CommandLine("pdf2swf");
    commandLine.addArgument("${inputFile}", false);
    commandLine.addArgument(OUTPUT_COMMAND);
    commandLine.addArgument("${outputFile}", false);
    commandLine.addArguments(TO_SWF_ENDING_COMMAND, false);
    if (StringUtil.isDefined(endingCommand)) {
        commandLine.addArguments(endingCommand, false);
    }/* ww  w. j ava 2 s  . c  o  m*/
    commandLine.setSubstitutionMap(files);
    return commandLine;
}

From source file:org.silverpeas.viewer.util.SwfUtil.java

static CommandLine buildPdfDocumentInfoCommandLine(File file) {
    Map<String, File> files = new HashMap<String, File>(1);
    files.put("file", file);
    CommandLine commandLine = new CommandLine("pdf2swf");
    commandLine.addArgument("-qq");
    commandLine.addArgument("${file}", false);
    commandLine.addArgument("--info");
    commandLine.setSubstitutionMap(files);
    return commandLine;
}

From source file:org.silverpeas.viewer.util.SwfUtil.java

static CommandLine buildSwfToImageCommandLine(File inputFile, File outputFile) {
    Map<String, File> files = new HashMap<String, File>(2);
    files.put("inputFile", inputFile);
    files.put("outputFile", outputFile);
    CommandLine commandLine = new CommandLine("swfrender");
    commandLine.addArgument("${inputFile}", false);
    commandLine.addArgument(OUTPUT_COMMAND);
    commandLine.addArgument("${outputFile}", false);
    commandLine.setSubstitutionMap(files);
    return commandLine;
}