use of org.fagu.fmv.cli.FMVCLIConfig in project fmv by f-agu.
the class Bootstrap method openFMVCLIConfig.
/**
* @param conf
* @return
* @throws IOException
*/
private static FMVCLIConfig openFMVCLIConfig(String conf) throws IOException {
File file = new File(conf);
if (!file.exists()) {
System.out.println("File not found: " + conf);
return new FMVCLIConfig();
}
Properties properties = new Properties();
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
properties.load(inputStream);
} finally {
IOUtils.closeQuietly(inputStream);
}
return new FMVCLIConfig(properties);
}
use of org.fagu.fmv.cli.FMVCLIConfig 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();
}
Aggregations