Added 3gp format conversion. Removed legacy functionality.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 15 Oct 2017 01:24:25 +0000 (04:24 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 15 Oct 2017 01:24:25 +0000 (04:24 +0300)
meviz.iml
pom.xml
src/main/java/eu/svjatoslav/meviz/Main.java
src/main/java/eu/svjatoslav/meviz/encoder/converters/AvconvVideo.java
src/main/java/eu/svjatoslav/meviz/textsplitter/CommandlineHandler.java [deleted file]
src/main/java/eu/svjatoslav/meviz/textsplitter/Main.java [deleted file]
src/main/java/eu/svjatoslav/meviz/textsplitter/TextSplittingOptions.java [deleted file]
src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java [deleted file]
src/main/java/eu/svjatoslav/meviz/texttruncate/Main.java [deleted file]
src/main/java/eu/svjatoslav/meviz/texttruncate/TextTruncatingOptions.java [deleted file]

index 37a4af7..4daca25 100644 (file)
--- a/meviz.iml
+++ b/meviz.iml
@@ -10,7 +10,7 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Maven: eu.svjatoslav:svjatoslavcommons:1.6-SNAPSHOT" level="project" />
+    <orderEntry type="library" name="Maven: eu.svjatoslav:svjatoslavcommons:1.7-SNAPSHOT" level="project" />
     <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 1b42d88..c5d4567 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
         <dependency>
             <groupId>eu.svjatoslav</groupId>
             <artifactId>svjatoslavcommons</artifactId>
-            <version>1.6-SNAPSHOT</version>
+            <version>1.7-SNAPSHOT</version>
         </dependency>
 
         <dependency>
index ad014bf..3b426b0 100755 (executable)
@@ -32,8 +32,6 @@ class Main {
         modules.add(new eu.svjatoslav.meviz.htmlindexer.Main());
         modules.add(new eu.svjatoslav.meviz.renamer.Main());
         modules.add(new eu.svjatoslav.meviz.grabmemcard.Main());
-        modules.add(new eu.svjatoslav.meviz.texttruncate.Main());
-        modules.add(new eu.svjatoslav.meviz.textsplitter.Main());
         modules.add(new eu.svjatoslav.meviz.bomremove.Main());
         modules.add(new eu.svjatoslav.meviz.replace.Main());
     }
index 2492b52..8539452 100644 (file)
@@ -123,7 +123,7 @@ public class AvconvVideo extends AbstractConverter {
 
     private List<String> getSupportedExtensions() {
         return toList("mkv", "mts", "mp4", "avi", "mpg", "mpeg", "vob", "m4v",
-                "webm", "mov", "asf");
+                "webm", "mov", "asf", "3gp");
     }
 
     @Override
diff --git a/src/main/java/eu/svjatoslav/meviz/textsplitter/CommandlineHandler.java b/src/main/java/eu/svjatoslav/meviz/textsplitter/CommandlineHandler.java
deleted file mode 100755 (executable)
index 21a2ed4..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.textsplitter;
-
-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.StringParameters;
-
-import java.io.File;
-
-class CommandlineHandler {
-
-    final Parser parser = new Parser();
-
-    private final NullParameter recursiveParameter = parser.add(
-            new NullParameter("Enable recursive mode.")).addAliases("-r",
-            "--recursive");
-
-    private final StringParameters fileInputPatternsParameter = parser.add(
-            new StringParameters("File input pattern.").addAliases("-i",
-                    "--input-pattern")).setMandatory();
-
-    private final StringParameters splitPatternsParameter = parser
-            .add(new StringParameters("File split regular expression."))
-            .addAliases("-s", "--split-pattern").setMandatory();
-
-    private final DirectoryParameter workingDirectoryParameter = parser.add(
-            new DirectoryParameter("Working directory.")).addAliases("-w",
-            "--working-directory");
-
-    public TextSplittingOptions parseCommandlineArguments(final String[] args) {
-
-        final TextSplittingOptions options = new TextSplittingOptions();
-
-        if (!parser.parse(args))
-            return null;
-
-        if (recursiveParameter.isSpecified())
-            options.recursive = true;
-
-        if (workingDirectoryParameter.isSpecified())
-            options.targetDirectory = workingDirectoryParameter.getValue();
-        else
-            options.targetDirectory = new File(System.getProperty("user.dir"));
-
-        if (fileInputPatternsParameter.isSpecified())
-            options.fileInputPatterns.addAll(fileInputPatternsParameter
-                    .getValue());
-
-        if (splitPatternsParameter.isSpecified())
-            options.textSplitPatterns.addAll(splitPatternsParameter.getValue());
-
-        return options;
-    }
-}
diff --git a/src/main/java/eu/svjatoslav/meviz/textsplitter/Main.java b/src/main/java/eu/svjatoslav/meviz/textsplitter/Main.java
deleted file mode 100755 (executable)
index c955796..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.textsplitter;
-
-import eu.svjatoslav.commons.file.FilePathParser;
-import eu.svjatoslav.commons.string.String2;
-import eu.svjatoslav.commons.string.WildCardMatcher;
-import eu.svjatoslav.meviz.Module;
-
-import java.io.*;
-
-public class Main implements Module {
-
-    private final CommandlineHandler commandlineHandler = new CommandlineHandler();
-
-    private TextSplittingOptions options;
-
-    private boolean fileMatchesInputPattern(final File file) {
-        final String fileName = file.getName().toLowerCase();
-
-        for (final String inputPattern : options.fileInputPatterns)
-            if (WildCardMatcher.match(fileName, inputPattern.toLowerCase()))
-                return true;
-
-        return false;
-    }
-
-    @Override
-    public String getDescription() {
-        return "Split text with long lines into multiple shorter lines.";
-    }
-
-    @Override
-    public String getModuleCommand() {
-        return "splittext";
-    }
-
-    private File getTargetFile(final File sourceFile) {
-        final StringBuilder targetFilePath = new StringBuilder();
-        targetFilePath.append(sourceFile.getParent());
-        targetFilePath.append("/");
-        targetFilePath.append(FilePathParser
-                .getFileNameWithoutExtension(sourceFile));
-
-        targetFilePath.append(".splitted");
-
-        // add file extension
-        {
-            final String fileExtension = FilePathParser
-                    .getFileExtension(sourceFile);
-
-            if (fileExtension.length() > 0)
-                targetFilePath.append("." + fileExtension);
-        }
-        return new File(targetFilePath.toString());
-    }
-
-    private void processDirectory(final File directory) {
-
-        for (final File subFile : directory.listFiles())
-            if (subFile.isDirectory()) {
-                if (options.recursive)
-                    processDirectory(subFile);
-            } else if (fileMatchesInputPattern(subFile))
-                try {
-                    processFile(subFile);
-                } catch (final IOException exception) {
-                    System.out.println("Error processing file: "
-                            + subFile.getAbsolutePath());
-                    System.out.println("   exception: "
-                            + exception.getMessage());
-                }
-
-    }
-
-    private void processFile(final File file) throws IOException {
-        final File targetFile = getTargetFile(file);
-
-        final BufferedReader bufferedReader = new BufferedReader(
-                new FileReader(file));
-
-        final BufferedWriter bufferedWriter = new BufferedWriter(
-                new FileWriter(targetFile));
-
-        while (true) {
-            final String readLine = bufferedReader.readLine();
-            if (readLine == null)
-                break;
-
-            final String2 cuttableString = new String2(readLine);
-
-            while (!cuttableString.isEmpty()) {
-                for (final String pattern : options.textSplitPatterns)
-                    if (WildCardMatcher.match(cuttableString.toString(),
-                            pattern))
-                        bufferedWriter.write("\n");
-
-                final String character = cuttableString.trimLeft(1);
-                bufferedWriter.append(character);
-            }
-
-            bufferedWriter.write("\n");
-        }
-
-        bufferedReader.close();
-        bufferedWriter.close();
-    }
-
-    @Override
-    public void run(final String[] args) throws IOException {
-
-        options = commandlineHandler.parseCommandlineArguments(args);
-
-        if (options == null) {
-            showCommandlineHelp();
-            return;
-        }
-
-        processDirectory(options.targetDirectory);
-
-    }
-
-    @Override
-    public void showCommandlineHelp() {
-        commandlineHandler.parser.showHelp();
-    }
-
-}
diff --git a/src/main/java/eu/svjatoslav/meviz/textsplitter/TextSplittingOptions.java b/src/main/java/eu/svjatoslav/meviz/textsplitter/TextSplittingOptions.java
deleted file mode 100755 (executable)
index 8e7845d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.textsplitter;
-
-import java.io.File;
-import java.util.ArrayList;
-
-public class TextSplittingOptions {
-
-    public final ArrayList<String> fileInputPatterns = new ArrayList<>();
-
-    public final ArrayList<String> textSplitPatterns = new ArrayList<>();
-
-    public boolean recursive = false;
-
-    public File targetDirectory;
-
-}
diff --git a/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java b/src/main/java/eu/svjatoslav/meviz/texttruncate/CommandlineHandler.java
deleted file mode 100755 (executable)
index eec92d0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.texttruncate;
-
-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.StringParameters;
-
-import java.io.File;
-
-class CommandlineHandler {
-
-    final Parser parser = new Parser();
-
-    private final NullParameter recursiveParameter = parser.add(
-            new NullParameter("Enable recursive mode.")).addAliases("-r",
-            "--recursive");
-
-    private final StringParameters inputPatternParameter = parser.add(
-            new StringParameters("File input pattern.")).addAliases("-i",
-            "--input-pattern");
-
-    private final DirectoryParameter workingDirectoryParameter = parser.add(
-            new DirectoryParameter("Working directory.")).addAliases("-w",
-            "--working-directory");
-
-    public TextTruncatingOptions parseCommandlineArguments(final String[] args) {
-
-        final TextTruncatingOptions options = new TextTruncatingOptions();
-
-        if (!parser.parse(args))
-            return null;
-
-        if (recursiveParameter.isSpecified())
-            options.recursive = true;
-
-        if (workingDirectoryParameter.isSpecified())
-            options.targetDirectory = workingDirectoryParameter.getValue();
-        else
-            options.targetDirectory = new File(System.getProperty("user.dir"));
-
-        if (inputPatternParameter.isSpecified())
-            options.inputPatterns.addAll(inputPatternParameter.getValue());
-
-        return options;
-    }
-}
diff --git a/src/main/java/eu/svjatoslav/meviz/texttruncate/Main.java b/src/main/java/eu/svjatoslav/meviz/texttruncate/Main.java
deleted file mode 100755 (executable)
index 4594979..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.texttruncate;
-
-import eu.svjatoslav.commons.file.FilePathParser;
-import eu.svjatoslav.commons.string.String2;
-import eu.svjatoslav.commons.string.WildCardMatcher;
-import eu.svjatoslav.meviz.Module;
-
-import java.io.*;
-
-public class Main implements Module {
-
-    private static final int targetLineLength = 200;
-
-    private static final int maxSplittedLines = 3;
-
-    private static final String splitLinePrefix = "    ";
-
-    private final CommandlineHandler commandlineHandler = new CommandlineHandler();
-
-    private TextTruncatingOptions options;
-
-    private boolean fileMatchesInputPattern(final File file) {
-        final String fileName = file.getName().toLowerCase();
-
-        for (final String inputPattern : options.inputPatterns)
-            if (WildCardMatcher.match(fileName, inputPattern.toLowerCase()))
-                return true;
-
-        return false;
-    }
-
-    @Override
-    public String getDescription() {
-        return "Truncate text with long lines into multiple shorter lines.";
-    }
-
-    @Override
-    public String getModuleCommand() {
-        return "trunctext";
-    }
-
-    private File getTargetFile(final File sourceFile) {
-        final StringBuilder targetFilePath = new StringBuilder();
-        targetFilePath.append(sourceFile.getParent());
-        targetFilePath.append("/");
-        targetFilePath.append(FilePathParser
-                .getFileNameWithoutExtension(sourceFile));
-
-        targetFilePath.append(".truncated");
-
-        // add file extension
-        {
-            final String fileExtension = FilePathParser
-                    .getFileExtension(sourceFile);
-
-            if (fileExtension.length() > 0)
-                targetFilePath.append("." + fileExtension);
-        }
-        return new File(targetFilePath.toString());
-    }
-
-    private void processDirectory(final File directory) {
-
-        for (final File subFile : directory.listFiles())
-            if (subFile.isDirectory()) {
-                if (options.recursive)
-                    processDirectory(subFile);
-            } else if (fileMatchesInputPattern(subFile))
-                try {
-                    processFile(subFile);
-                } catch (final IOException exception) {
-                    System.out.println("Error processing file: "
-                            + subFile.getAbsolutePath());
-                    System.out.println("   exception: "
-                            + exception.getMessage());
-                }
-
-    }
-
-    private void processFile(final File file) throws IOException {
-        final File targetFile = getTargetFile(file);
-
-        final BufferedReader bufferedReader = new BufferedReader(
-                new FileReader(file));
-
-        final BufferedWriter bufferedWriter = new BufferedWriter(
-                new FileWriter(targetFile));
-
-        while (true) {
-            final String readLine = bufferedReader.readLine();
-            if (readLine == null)
-                break;
-
-            if (readLine.length() <= targetLineLength)
-                bufferedWriter.write(readLine + "\n");
-            else {
-
-                final String2 cuttableString = new String2(readLine);
-
-                bufferedWriter.write(cuttableString.trimLeft(targetLineLength)
-                        + "\n");
-
-                int splittedLinesCount = 0;
-
-                while (!cuttableString.isEmpty()) {
-                    splittedLinesCount++;
-                    if (splittedLinesCount >= maxSplittedLines)
-                        break;
-
-                    bufferedWriter.write(splitLinePrefix
-                            + cuttableString.trimLeft(targetLineLength
-                            - splitLinePrefix.length()) + "\n");
-                }
-            }
-
-        }
-
-        bufferedReader.close();
-        bufferedWriter.close();
-    }
-
-    @Override
-    public void run(final String[] args) throws IOException {
-
-        options = commandlineHandler.parseCommandlineArguments(args);
-
-        if (options == null) {
-            showCommandlineHelp();
-            return;
-        }
-
-        processDirectory(options.targetDirectory);
-
-    }
-
-    @Override
-    public void showCommandlineHelp() {
-        commandlineHandler.parser.showHelp();
-    }
-
-}
diff --git a/src/main/java/eu/svjatoslav/meviz/texttruncate/TextTruncatingOptions.java b/src/main/java/eu/svjatoslav/meviz/texttruncate/TextTruncatingOptions.java
deleted file mode 100755 (executable)
index 5550762..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2017, 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.
- */
-
-package eu.svjatoslav.meviz.texttruncate;
-
-import java.io.File;
-import java.util.ArrayList;
-
-public class TextTruncatingOptions {
-
-    public final ArrayList<String> inputPatterns = new ArrayList<>();
-
-    public boolean recursive = false;
-
-    public File targetDirectory;
-
-}