<dependency>
<groupId>eu.svjatoslav</groupId>
<artifactId>svjatoslavcommons</artifactId>
- <version>1.3</version>
+ <version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
/*
* 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.
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 {
NullParameter recursiveParameter = parser.createNullParameter(
"Enable recursive mode.").addAliases("-r", "--recursive");
- StringParameter inputPatternParameter = parser.createStringParameter(
+ StringParameters inputPatternParameter = parser.createStringParameters(
"File input pattern.").addAliases("-i", "--input-pattern");
DirectoryParameter workingDirectoryParameter = parser
// TODO: add support for multiple input patterns
if (inputPatternParameter.isParameterSpecified())
- options.inputPatterns.addAll(inputPatternParameter
- .getArgumentsAsStrings());
+ options.inputPatterns.addAll(inputPatternParameter.getValue());
return options;
}
/*
* 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.
public class BitrateParameter extends Parameter {
- public BitrateParameter(String description) {
+ static public enum bitrate {
+ LOW, MEDIUM, HIGH, COPY
+ }
+
+ public BitrateParameter(final String description) {
super(description, ArgumentCount.SINGLE);
}
+ @Override
+ public BitrateParameter addAliases(final String... aliasArray) {
+ addAliasesProtected(aliasArray);
+ return this;
+ }
+
@Override
public String describeFormat() {
return "Target bitrate [LOW / MEDIUM / HIGH / COPY]";
+ };
+
+ @Override
+ public bitrate getValue() {
+ return bitrate.valueOf(arguments.get(0).toUpperCase());
+ }
+
+ @Override
+ public BitrateParameter setMandatory() {
+ setMandatoryProtected();
+ return this;
}
@Override
return true;
}
-
- static public enum bitrate {
- LOW, MEDIUM, HIGH, COPY
- };
-
- public bitrate getValue() {
- return bitrate.valueOf(getArgumentsAsStrings().get(0).toUpperCase());
- }
}
/*
* 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.
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(
NullParameter forPortableParameter = parser.createNullParameter(
"Encode for portable player.").addAliases("-p", "--portable");
- StringParameter inputPatternParameter = parser
- .createStringParameter("File input pattern.")
+ StringParameters inputPatternParameter = parser
+ .createStringParameters("File input pattern.")
.addAliases("-i", "--input-pattern").setMandatory();
DirectoryParameter workingDirectoryParameter = parser
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();
/*
* 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.
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;
import eu.svjatoslav.meviz.encoder.EncodingOptions;
public class CommandlineHandler {
StringParameter outputPatternParameter = parser.createStringParameter(
"Output pattern.").addAliases("-o", "--output-pattern");
- StringParameter inputPatternParameter = parser.createStringParameter(
+ StringParameters inputPatternParameter = parser.createStringParameters(
"File input pattern.").addAliases("-i", "--input-pattern");
DirectoryParameter workingDirectoryParameter = parser
// TODO: add multiple input patterns support
if (inputPatternParameter.isParameterSpecified())
- options.inputPatterns.addAll(inputPatternParameter
- .getArgumentsAsStrings());
+ options.inputPatterns.addAll(inputPatternParameter.getValue());
return options;
}
/*
* 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.
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 {
NullParameter recursiveParameter = parser.createNullParameter(
"Enable recursive mode.").addAliases("-r", "--recursive");
- StringParameter fileInputPatternsParameter = parser
- .createStringParameter("File input pattern.")
+ StringParameters fileInputPatternsParameter = parser
+ .createStringParameters("File input pattern.")
.addAliases("-i", "--input-pattern").setMandatory();
- StringParameter splitPatternsParameter = parser
- .createStringParameter("File split regular expression.")
+ StringParameters splitPatternsParameter = parser
+ .createStringParameters("File split regular expression.")
.addAliases("-s", "--split-pattern").setMandatory();
DirectoryParameter workingDirectoryParameter = parser
if (fileInputPatternsParameter.isParameterSpecified())
options.fileInputPatterns.addAll(fileInputPatternsParameter
- .getArgumentsAsStrings());
+ .getValue());
if (splitPatternsParameter.isParameterSpecified())
- options.textSplitPatterns.addAll(splitPatternsParameter
- .getArgumentsAsStrings());
+ options.textSplitPatterns.addAll(splitPatternsParameter.getValue());
return options;
}
/*
* 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.
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 {
NullParameter recursiveParameter = parser.createNullParameter(
"Enable recursive mode.").addAliases("-r", "--recursive");
- StringParameter inputPatternParameter = parser.createStringParameter(
+ StringParameters inputPatternParameter = parser.createStringParameters(
"File input pattern.").addAliases("-i", "--input-pattern");
DirectoryParameter workingDirectoryParameter = parser
options.recursive = true;
if (workingDirectoryParameter.isParameterSpecified())
- options.targetDirectory = workingDirectoryParameter
- .getArgumentsAsFiles().get(0);
+ options.targetDirectory = workingDirectoryParameter.getValue();
else
options.targetDirectory = new File(System.getProperty("user.dir"));
if (inputPatternParameter.isParameterSpecified())
- options.inputPatterns.addAll(inputPatternParameter
- .getArgumentsAsStrings());
+ options.inputPatterns.addAll(inputPatternParameter.getValue());
return options;
}