support for copy codec for avconv
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / CommandlineHandler.java
index b6e10ce..102ca7a 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * Meviz - Various tools collection to work with multimedia.
  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU General Public License
  * as published by the Free Software Foundation.
@@ -12,14 +12,14 @@ package eu.svjatoslav.meviz.encoder;
 import eu.svjatoslav.commons.commandline.parameterparser.Parser;
 import eu.svjatoslav.commons.commandline.parameterparser.parameter.DirectoryParameter;
 import eu.svjatoslav.commons.commandline.parameterparser.parameter.NullParameter;
-import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
+import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameters;
 
 public class CommandlineHandler {
 
        Parser parser = new Parser();
 
-       StringParameter outputFormatParameter = parser
-                       .createStringParameter("Encoding output format.")
+       StringParameters outputFormatParameter = parser
+                       .createStringParameters("Encoding output format.")
                        .addAliases("-o", "--output-format").setMandatory();
 
        NullParameter deinterlaceParameter = parser.createNullParameter(
@@ -31,8 +31,11 @@ public class CommandlineHandler {
        NullParameter recursiveParameter = parser.createNullParameter(
                        "Enable recursive mode.").addAliases("-r", "--recursive");
 
-       StringParameter inputPatternParameter = parser
-                       .createStringParameter("File input pattern.")
+       NullParameter forPortableParameter = parser.createNullParameter(
+                       "Encode for portable player.").addAliases("-p", "--portable");
+
+       StringParameters inputPatternParameter = parser
+                       .createStringParameters("File input pattern.")
                        .addAliases("-i", "--input-pattern").setMandatory();
 
        DirectoryParameter workingDirectoryParameter = parser
@@ -58,26 +61,22 @@ public class CommandlineHandler {
 
                parser.parse(args);
 
-               if (recursiveParameter.isParameterSpecified())
-                       options.recursive = true;
+               options.recursive = recursiveParameter.isParameterSpecified();
 
-               if (deinterlaceParameter.isParameterSpecified())
-                       options.deinterlace = true;
+               options.deinterlace = deinterlaceParameter.isParameterSpecified();
 
-               if (testParameter.isParameterSpecified())
-                       options.testOnly = true;
+               options.testOnly = testParameter.isParameterSpecified();
 
                if (outputFormatParameter.isParameterSpecified())
-                       options.outputFormats.addAll(outputFormatParameter
-                                       .getArgumentsAsStrings());
+                       options.outputFormats.addAll(outputFormatParameter.getValue());
 
                if (workingDirectoryParameter.isParameterSpecified())
-                       options.workingDirectory = workingDirectoryParameter
-                                       .getArgumentsAsFiles().get(0);
+                       options.workingDirectory = workingDirectoryParameter.getValue();
 
                if (inputPatternParameter.isParameterSpecified())
-                       options.inputPatterns.addAll(inputPatternParameter
-                                       .getArgumentsAsStrings());
+                       options.inputPatterns.addAll(inputPatternParameter.getValue());
+
+               options.forPortablePlayer = forPortableParameter.isParameterSpecified();
 
                if (videoBitrateParameter.isParameterSpecified())
                        try {