Search in sources :

Example 1 with Console

use of org.fagu.fmv.cli.Console in project fmv by f-agu.

the class Bootstrap method main.

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    if (!FFMpeg.search().isFound()) {
        System.out.println("FFMpeg not found !");
        return;
    }
    if (!FFProbe.search().isFound()) {
        System.out.println("FFProbe not found !");
        return;
    }
    CommandLineParser parser = new GnuParser();
    Options options = new Options();
    options.addOption("c", "conf", true, "Conf properties");
    CommandLine commandLine = parser.parse(options, args);
    FMVCLIConfig fmvcliConfig;
    if (commandLine.hasOption('c')) {
        String conf = commandLine.getOptionValue('c');
        fmvcliConfig = openFMVCLIConfig(conf);
    } else {
        fmvcliConfig = new FMVCLIConfig();
    }
    System.out.println("FMV " + FMV.getVersion());
    System.out.println();
    Project project;
    String[] args2 = commandLine.getArgs();
    if (args2.length > 0) {
        project = loadProject(new File(args2[0]));
    } else {
        project = menu(System.out);
    }
    Console console = new Console(new Environnement(project, fmvcliConfig));
    console.run();
}
Also used : Options(org.apache.commons.cli.Options) Project(org.fagu.fmv.core.project.Project) CommandLine(org.apache.commons.cli.CommandLine) FMVCLIConfig(org.fagu.fmv.cli.FMVCLIConfig) GnuParser(org.apache.commons.cli.GnuParser) Console(org.fagu.fmv.cli.Console) Environnement(org.fagu.fmv.cli.Environnement) CommandLineParser(org.apache.commons.cli.CommandLineParser) File(java.io.File)

Aggregations

File (java.io.File)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 GnuParser (org.apache.commons.cli.GnuParser)1 Options (org.apache.commons.cli.Options)1 Console (org.fagu.fmv.cli.Console)1 Environnement (org.fagu.fmv.cli.Environnement)1 FMVCLIConfig (org.fagu.fmv.cli.FMVCLIConfig)1 Project (org.fagu.fmv.core.project.Project)1