private boolean useTerminal;
- private String targetFormat;
+ private final String targetFormat;
- public EncodingTask(
- final File source,
- final File destination,
- final eu.svjatoslav.meviz.encoder.converters.AbstractConverter converter,
- String targetFormat) {
+ public EncodingTask(final File source, final File target, final AbstractConverter converter,
+ final String targetFormat) {
this.source = source;
- target = destination;
+ this.target = target;
this.converter = converter;
this.targetFormat = targetFormat;
}
System.out.println("Executing command: " + command);
- final Runtime run = Runtime.getRuntime();
- Process pr;
- pr = run.exec(new String[] { "/bin/bash", "-c", command });
+ final Runtime runtime = Runtime.getRuntime();
+ final Process process = runtime.exec(new String[] { "/bin/bash", "-c", command });
- pr.waitFor();
+ process.waitFor();
} catch (final Exception e) {
System.out.println(e.toString());
}
public String getCommand(final EncodingOptions encodingOptions) {
- return converter.getCommand(source, target, encodingOptions,
- targetFormat);
+ return converter.getCommand(source, target, encodingOptions, targetFormat);
}
/**
}
public File[] getDiskVideos(final File file) {
- final String videosPath = file.getAbsolutePath()
- + "/AVCHD/BDMV/STREAM/";
+ final String videosPath = file.getAbsolutePath() + "/AVCHD/BDMV/STREAM/";
final File videosDirectory = new File(videosPath);
if (!videosDirectory.exists())
return valueString;
};
+ private EncodingOptions getEncodingOptions() {
+ final EncodingOptions options = new EncodingOptions();
+ options.setVideoBitrate(BitrateParameter.bitrate.COPY);
+ options.setAudioBitrate(BitrateParameter.bitrate.COPY);
+ return options;
+ }
+
@Override
public String getModuleCommand() {
return "grabmemcard";
final GregorianCalendar calendar = new GregorianCalendar();
final StringBuffer directoryName = new StringBuffer();
- directoryName.append(calendar.get(GregorianCalendar.YEAR) + "."
- + getDoubleDigit(calendar.get(GregorianCalendar.MONTH) + 1)
- + "."
- + getDoubleDigit(calendar.get(GregorianCalendar.DAY_OF_MONTH))
- + " ");
-
- directoryName.append(getDoubleDigit(now.getHours()) + ":"
- + getDoubleDigit(now.getMinutes()) + ":"
+ directoryName.append(
+ calendar.get(GregorianCalendar.YEAR) + "." + getDoubleDigit(calendar.get(GregorianCalendar.MONTH) + 1)
+ + "." + getDoubleDigit(calendar.get(GregorianCalendar.DAY_OF_MONTH)) + " ");
+
+ directoryName.append(getDoubleDigit(now.getHours()) + ":" + getDoubleDigit(now.getMinutes()) + ":"
+ getDoubleDigit(now.getSeconds()));
- final String targetDirectoryPath = CommonPathResolver
- .getDesktopDirectory().getAbsolutePath()
- + "/"
+ final String targetDirectoryPath = CommonPathResolver.getDesktopDirectory().getAbsolutePath() + "/"
+ directoryName.toString() + "/";
System.out.println("Target directory path: " + targetDirectoryPath);
return new File(targetDirectoryPath);
}
+ private File getTargetFile(final File targetDirectory, final File sourceFile) {
+ // compute target file path
+ final StringBuffer targetFilePath = new StringBuffer();
+ targetFilePath.append(targetDirectory.getAbsolutePath());
+ targetFilePath.append("/");
+ targetFilePath.append(FilePathParser.getFileNameWithoutExtension(sourceFile));
+ targetFilePath.append(".mp4");
+ final File targetFile = new File(targetFilePath.toString());
+ return targetFile;
+ }
+
@Override
public void run(final String[] args) throws IOException {
final File targetFile = getTargetFile(targetDirectory, sourceFile);
- final EncodingTask encodingTask = new EncodingTask(sourceFile,
- targetFile, converter, "mp4");
+ final EncodingTask encodingTask = new EncodingTask(sourceFile, targetFile, converter, "mp4");
+ encodingTask.setUseTerminal(true);
encodingPlan.scheduleTask(encodingTask);
}
}
encodingPlan.execute(getEncodingOptions());
}
- private EncodingOptions getEncodingOptions() {
- final EncodingOptions options = new EncodingOptions();
- options.setVideoBitrate(BitrateParameter.bitrate.COPY);
- options.setAudioBitrate(BitrateParameter.bitrate.COPY);
- return options;
- }
-
- private File getTargetFile(final File targetDirectory, final File sourceFile) {
- // compute target file path
- final StringBuffer targetFilePath = new StringBuffer();
- targetFilePath.append(targetDirectory.getAbsolutePath());
- targetFilePath.append("/");
- targetFilePath.append(FilePathParser
- .getFileNameWithoutExtension(sourceFile));
- targetFilePath.append(".mp4");
- final File targetFile = new File(targetFilePath.toString());
- return targetFile;
- }
-
@Override
public void showCommandlineHelp() {
System.out.println("memory card grabber has no commandline options");