Adds lots of improvements

This commit is contained in:
Kristian Knarvik 2020-02-10 22:50:35 +01:00
parent 20e6df04f1
commit b2e1cc83fc
7 changed files with 198 additions and 469 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/nbproject/private/
/build/
/dist/

View File

@ -3,7 +3,7 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8.0_191" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="11.0.5" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -7,172 +7,19 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e9b48a04-29ff-46ce-9630-42742dc34d68" name="Default" comment="Rewrites a lot of code&#10;&#10;Streams are now parsed to objects, making it easier to get required information.&#10;Improved styling.&#10;Some better comments.&#10;Better input parsing.">
<change afterPath="$PROJECT_DIR$/src/ffmpegconverter/streams/AudioStream.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/ffmpegconverter/streams/StreamObject.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/ffmpegconverter/streams/VideoStream.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/converter/AnimeConverter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/converter/AnimeConverter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/converter/AudioConverter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/converter/AudioConverter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/converter/Converter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/converter/Converter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/converter/VideoConverter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/converter/VideoConverter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/META-INF/MANIFEST.MF">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" selection-start-line="3" selection-end-line="3" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/Converter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="398" column="80" selection-start-line="398" selection-start-column="80" selection-end-line="398" selection-end-column="80" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#fileCollisionPrevention#0;class#Converter#0" />
<element signature="docComment;method#read#0;class#Converter#0" />
<element signature="method#read#0;class#Converter#0" />
<element signature="docComment;method#ffmpegWebVideo#0;class#Converter#0" />
<element signature="method#ffmpegWebVideo#0;class#Converter#0" />
<element signature="docComment;method#generalFile#0;class#Converter#0" />
<element signature="method#generalFile#0;class#Converter#0" />
<element signature="docComment;method#listIndexes#0;class#Converter#0" />
<element signature="docComment;method#stringBetween#0;class#Converter#0" />
<element signature="docComment;method#stringBetweenSingle#0;class#Converter#0" />
<element signature="method#stringBetweenSingle#0;class#Converter#0" />
<element signature="e#7792#7793#0" expanded="true" />
<element signature="e#7875#7876#0" expanded="true" />
<element signature="e#7924#7925#0" expanded="true" />
<element signature="e#7987#7988#0" expanded="true" />
<element signature="docComment;method#concatenate#0;class#Converter#0" />
<element signature="method#concatenate#0;class#Converter#0" />
<element signature="docComment;method#parseStreams#0;class#Converter#0" />
<element signature="method#parseStreams#0;class#Converter#0" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/AudioStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="27" column="5" selection-start-line="27" selection-start-column="5" selection-end-line="27" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="47" column="4" selection-start-line="47" selection-start-column="4" selection-end-line="47" selection-end-column="4" />
<folding>
<element signature="e#980#981#0" expanded="true" />
<element signature="e#1066#1067#0" expanded="true" />
<element signature="e#1658#1659#0" expanded="true" />
<element signature="e#1723#1724#0" expanded="true" />
<element signature="e#1809#1810#0" expanded="true" />
<element signature="e#1893#1894#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/VideoStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="38" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/StreamObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="23" column="4" selection-start-line="23" selection-start-column="4" selection-end-line="23" selection-end-column="4" />
<folding>
<element signature="e#313#314#0" expanded="true" />
<element signature="e#350#351#0" expanded="true" />
<element signature="e#469#470#0" expanded="true" />
<element signature="e#506#507#0" expanded="true" />
<element signature="e#639#640#0" expanded="true" />
<element signature="e#680#681#0" expanded="true" />
<element signature="e#841#842#0" expanded="true" />
<element signature="e#882#883#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/AnimeConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="147">
<caret line="71" column="52" lean-forward="true" selection-start-line="71" selection-start-column="52" selection-end-line="71" selection-end-column="52" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5093#5094#0" expanded="true" />
<element signature="e#5129#5130#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/AudioConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="27" selection-start-line="6" selection-start-column="27" selection-end-line="6" selection-end-column="27" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="395">
<caret line="138" column="53" lean-forward="true" selection-start-line="138" selection-start-column="53" selection-end-line="138" selection-end-column="53" />
<folding>
<element signature="imports" expanded="true" />
<element signature="class#converterArgumentValueType#0;class#Main#0" />
<element signature="method#tokenizer#0;class#Main#0" />
<element signature="method#getList#0;class#Main#0" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/VideoConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="61" column="12" selection-start-line="61" selection-start-column="12" selection-end-line="61" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
<element signature="docComment;method#processFile#0;class#VideoConverter#0" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
@ -204,77 +51,17 @@
<option name="ROOT_SYNC" value="DONT_SYNC" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/ffmpegconverter/streams/Video.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/streams/AudioStream.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/converter/AnimeConverter.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/converter/AudioConverter.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/streams/StreamObject.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/streams/VideoStream.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/Main.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/converter/Converter.java" />
<option value="$PROJECT_DIR$/src/ffmpegconverter/converter/VideoConverter.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-7" />
<option name="width" value="974" />
<option name="height" value="1047" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="FFmpegConvert1" type="b2602c69:ProjectViewProjectNode" />
<item name="FFmpegConvert1" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="FFmpegConvert1" type="b2602c69:ProjectViewProjectNode" />
<item name="FFmpegConvert1" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="FFmpegConvert1" type="b2602c69:ProjectViewProjectNode" />
<item name="FFmpegConvert1" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="ffmpegconverter" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="FFmpegConvert1" type="b2602c69:ProjectViewProjectNode" />
<item name="FFmpegConvert1" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="ffmpegconverter" type="462c0819:PsiDirectoryNode" />
<item name="converter" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="FFmpegConvert1" type="b2602c69:ProjectViewProjectNode" />
<item name="FFmpegConvert1" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="ffmpegconverter" type="462c0819:PsiDirectoryNode" />
<item name="streams" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
<component name="ProjectId" id="1XaYXLh1NRiz0qdcyxwpVTUquTI" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1570316553479" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../rogue-one-oh-one" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1570424750556" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
@ -288,18 +75,6 @@
<recent name="C:\Users\Kristian\IdeaProjects\FFmpegConvert1" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="ffmpegconverter.Main" />
@ -329,6 +104,7 @@
</method>
</configuration>
<configuration default="true" type="TestNG">
<option name="TEST_OBJECT" value="CLASS" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<properties />
<listeners />
@ -423,7 +199,7 @@
<workItem from="1561850923206" duration="1264000" />
<workItem from="1566295287966" duration="29127000" />
<workItem from="1568269273856" duration="26000" />
<workItem from="1570010166713" duration="19096000" />
<workItem from="1570010166713" duration="21035000" />
</task>
<task id="LOCAL-00001" summary="Adds missing files">
<created>1538261222377</created>
@ -460,11 +236,18 @@
<option name="project" value="LOCAL" />
<updated>1566327932040</updated>
</task>
<option name="localTasksCounter" value="6" />
<task id="LOCAL-00006" summary="Rewrites a lot of code&#10;&#10;Streams are now parsed to objects, making it easier to get required information.&#10;Improved styling.&#10;Some better comments.&#10;Better input parsing.">
<created>1570316567291</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1570316567291</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="150829000" />
<option name="totallyTimeSpent" value="152768000" />
</component>
<component name="TodoView" selected-index="4">
<todo-panel id="selected-file">
@ -475,44 +258,6 @@
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1433902" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
<window_info id="UI Designer" order="4" />
<window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Duplicate detector" visible="true" weight="0.32936078" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32936078" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.75054705" weight="0.31310943" />
<window_info anchor="bottom" id="Debug" order="3" sideWeight="0.49895614" weight="0.39869988" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" sideWeight="0.49946696" weight="0.32936078" />
<window_info anchor="bottom" id="Version Control" order="7" sideWeight="0.4989059" weight="0.32827735" />
<window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
<window_info anchor="bottom" id="Statistic" order="9" sideWeight="0.49946696" weight="0.32932165" />
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.4989059" weight="0.32822758" />
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.24945295" side_tool="true" weight="0.47811815" />
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49840087" weight="0.32719395" />
<window_info anchor="bottom" id="Docker" order="13" show_stripe_button="false" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Database" order="6" />
<window_info anchor="right" id="Palette&#9;" order="7" />
<window_info anchor="right" id="Maven Projects" order="8" />
<window_info anchor="right" id="Maven" order="9" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
@ -525,141 +270,31 @@
<MESSAGE value="Rewrites a lot of code&#10;&#10;Streams are now parsed to objects, making it easier to get required information.&#10;Improved styling.&#10;Some better comments.&#10;Better input parsing." />
<option name="LAST_COMMIT_MESSAGE" value="Rewrites a lot of code&#10;&#10;Streams are now parsed to objects, making it easier to get required information.&#10;Improved styling.&#10;Some better comments.&#10;Better input parsing." />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/misc.xml" />
<entry file="file://$PROJECT_DIR$/uiDesigner.xml" />
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/META-INF/MANIFEST.MF">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" selection-start-line="3" selection-end-line="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/AudioConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="27" selection-start-line="6" selection-start-column="27" selection-end-line="6" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/VideoStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="38" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/AudioStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="27" column="5" selection-start-line="27" selection-start-column="5" selection-end-line="27" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/StreamObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="23" column="4" selection-start-line="23" selection-start-column="4" selection-end-line="23" selection-end-column="4" />
<folding>
<element signature="e#313#314#0" expanded="true" />
<element signature="e#350#351#0" expanded="true" />
<element signature="e#469#470#0" expanded="true" />
<element signature="e#506#507#0" expanded="true" />
<element signature="e#639#640#0" expanded="true" />
<element signature="e#680#681#0" expanded="true" />
<element signature="e#841#842#0" expanded="true" />
<element signature="e#882#883#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/streams/SubtitleStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="47" column="4" selection-start-line="47" selection-start-column="4" selection-end-line="47" selection-end-column="4" />
<folding>
<element signature="e#980#981#0" expanded="true" />
<element signature="e#1066#1067#0" expanded="true" />
<element signature="e#1658#1659#0" expanded="true" />
<element signature="e#1723#1724#0" expanded="true" />
<element signature="e#1809#1810#0" expanded="true" />
<element signature="e#1893#1894#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/Converter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="398" column="80" selection-start-line="398" selection-start-column="80" selection-end-line="398" selection-end-column="80" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#fileCollisionPrevention#0;class#Converter#0" />
<element signature="docComment;method#read#0;class#Converter#0" />
<element signature="method#read#0;class#Converter#0" />
<element signature="docComment;method#ffmpegWebVideo#0;class#Converter#0" />
<element signature="method#ffmpegWebVideo#0;class#Converter#0" />
<element signature="docComment;method#generalFile#0;class#Converter#0" />
<element signature="method#generalFile#0;class#Converter#0" />
<element signature="docComment;method#listIndexes#0;class#Converter#0" />
<element signature="docComment;method#stringBetween#0;class#Converter#0" />
<element signature="docComment;method#stringBetweenSingle#0;class#Converter#0" />
<element signature="method#stringBetweenSingle#0;class#Converter#0" />
<element signature="e#7792#7793#0" expanded="true" />
<element signature="e#7875#7876#0" expanded="true" />
<element signature="e#7924#7925#0" expanded="true" />
<element signature="e#7987#7988#0" expanded="true" />
<element signature="docComment;method#concatenate#0;class#Converter#0" />
<element signature="method#concatenate#0;class#Converter#0" />
<element signature="docComment;method#parseStreams#0;class#Converter#0" />
<element signature="method#parseStreams#0;class#Converter#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/VideoConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="61" column="12" selection-start-line="61" selection-start-column="12" selection-end-line="61" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
<element signature="docComment;method#processFile#0;class#VideoConverter#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="395">
<caret line="138" column="53" lean-forward="true" selection-start-line="138" selection-start-column="53" selection-end-line="138" selection-end-column="53" />
<folding>
<element signature="imports" expanded="true" />
<element signature="class#converterArgumentValueType#0;class#Main#0" />
<element signature="method#tokenizer#0;class#Main#0" />
<element signature="method#getList#0;class#Main#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ffmpegconverter/converter/AnimeConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="147">
<caret line="71" column="52" lean-forward="true" selection-start-line="71" selection-start-column="52" selection-end-line="71" selection-end-column="52" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5093#5094#0" expanded="true" />
<element signature="e#5129#5130#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<component name="WindowStateProjectService">
<state x="335" y="409" key="#com.intellij.ide.util.projectWizard.JdkChooserPanel.MyDialog" timestamp="1581285739239">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="335" y="409" key="#com.intellij.ide.util.projectWizard.JdkChooserPanel.MyDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1581285739239" />
<state x="49" y="65" key="CommitChangelistDialog2" timestamp="1581371268799">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="49" y="65" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1581371268799" />
<state width="914" height="354" key="GridCell.Tab.0.bottom" timestamp="1581371268844">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="914" height="354" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1581371268844" />
<state width="914" height="354" key="GridCell.Tab.0.center" timestamp="1581371268844">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="914" height="354" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1581371268844" />
<state width="914" height="354" key="GridCell.Tab.0.left" timestamp="1581371268844">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="914" height="354" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1581371268844" />
<state width="914" height="354" key="GridCell.Tab.0.right" timestamp="1581371268844">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="914" height="354" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1581371268844" />
</component>
<component name="masterDetails">
<states>

View File

@ -17,7 +17,8 @@ import java.util.function.Predicate;
public class Main {
private static final String FFPROBE_PATH = "ffprobe"; //Can be just ffprobe if it's in the path
private static final String FFMPEG_PATH = "ffmpeg"; //Can be just ffmpeg if it's in the path
private static Scanner in = new Scanner(System.in, "UTF-8");
private static final Scanner READER = new Scanner(System.in, "UTF-8");
private static final BufferedWriter WRITER = new BufferedWriter(new OutputStreamWriter(System.out));
private static Converter con = null;
public static void main(String[] args) throws IOException {
@ -27,7 +28,7 @@ public class Main {
int choice = getChoice("Which converter do you want do use?\n1. Anime to web mp4\n2. Audio converter\n3. VideoStream converter", 1, 3);
System.out.println("Input for this converter:");
printl("Input for this converter:");
switch (choice) {
case 1:
animeConverter();
@ -44,10 +45,10 @@ public class Main {
int recursionSteps = 1;
System.out.println("<Folder/File> [Recursions]");
printl("<Folder/File> [Recursions]: ");
List<String> input = readInput(2);
while (input.size() == 0) {
System.out.print("File path required.");
while (input.isEmpty()) {
print("File path required.");
input = readInput(2);
}
File folder = new File(input.get(0));
@ -55,7 +56,7 @@ public class Main {
try {
recursionSteps = Integer.parseInt(input.get(1));
} catch (NumberFormatException e) {
System.out.println("Recursion steps is invalid and will be ignored.");
printl("Recursion steps is invalid and will be ignored.");
}
}
@ -66,13 +67,35 @@ public class Main {
con.convert(file);
}
} else {
System.out.println("No valid files found in folder.");
printl("No valid files found in folder.");
}
} else if (folder.exists()) {
con.convert(folder);
} else {
System.out.println("Path " + folder.getAbsolutePath() + " does not point to any file or folder.");
}
WRITER.close();
}
/**
* Prints a string
* @param input <p>The string to print.</p>
* @throws IOException <p>If the writer can't be written to.</p>
*/
private static void print(String input) throws IOException {
WRITER.write(input);
WRITER.flush();
}
/**
* Prints a string and a line break
* @param input <p>The string to print.</p>
* @throws IOException <p>If the writer can't be written to.</p>
*/
private static void printl(String input) throws IOException {
WRITER.write(input);
WRITER.newLine();
WRITER.flush();
}
private enum converterArgumentValueType {
@ -108,7 +131,7 @@ public class Main {
case SINGLE_VALUE:
return !value.contains(" ");
case INT:
Integer.parseInt(value);
int ignored = Integer.parseInt(value);
return true;
}
return false;
@ -142,46 +165,59 @@ public class Main {
}
}
/**
* Tokenizes a string
* @param input <p>A string.</p>
* @return <p>A list of tokens.</p>
*/
private static List<String> tokenizer(String input) {
List<String> tokens = new ArrayList<>();
boolean startedQuote = false;
StringBuilder currentToken = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (c == ' ') {
if (!startedQuote) {
if (!currentToken.toString().trim().equals("")) {
tokens.add(currentToken.toString());
currentToken = new StringBuilder();
switch (c) {
case ' ':
if (!startedQuote) {
//If not inside "", a space marks the end of a parameter
if (!currentToken.toString().trim().equals("")) {
tokens.add(currentToken.toString());
currentToken = new StringBuilder();
} else {
currentToken = new StringBuilder();
}
} else {
currentToken = new StringBuilder();
currentToken.append(c);
}
} else {
break;
case '"':
if (startedQuote) {
if (!currentToken.toString().trim().equals("")) {
tokens.add(currentToken.toString());
currentToken = new StringBuilder();
}
startedQuote = false;
} else {
startedQuote = true;
currentToken = new StringBuilder();
} break;
default:
currentToken.append(c);
}
} else if (c == '"') {
if (startedQuote) {
if (!currentToken.toString().trim().equals("")) {
if (i == input.length() - 1) {
tokens.add(currentToken.toString());
currentToken = new StringBuilder();
}
startedQuote = false;
} else {
startedQuote = true;
currentToken = new StringBuilder();
}
} else {
currentToken.append(c);
if (i == input.length() - 1) {
tokens.add(currentToken.toString());
}
} break;
}
}
return tokens;
}
private static void animeConverter() {
System.out.println("[Audio languages jpn,eng,ger,fre] [Subtitle languages eng,ger,fre] [Convert to stereo if necessary true/false] [Prevent signs&songs subtitles true/false]\nYour input: ");
/**
* Initializes the anime converter
* @throws IOException <p>If something goes wrong.</p>
*/
private static void animeConverter() throws IOException {
printl("[Audio languages jpn,eng,ger,fre] [Subtitle languages eng,ger,fre] " +
"[Convert to stereo if necessary true/false] [Prevent signs&songs subtitles true/false]\nYour input: ");
List<String> input = readInput(4);
String[] audioLang = new String[]{"jpn", "*"};
String[] subtitleLang = new String[]{"eng", "*"};
@ -202,6 +238,12 @@ public class Main {
con = new AnimeConverter(FFPROBE_PATH, FFMPEG_PATH, audioLang, subtitleLang, toStereo, preventSigns);
}
/**
* Gets a list from a comma separated string at index in list
* @param list <p>A list of tokens.</p>
* @param index <p>The index of the token containing comma separated entries.</p>
* @return <p>A string list.</p>
*/
private static String[] getList(List<String> list, int index) {
String[] result = null;
if (list.size() > index) {
@ -214,8 +256,13 @@ public class Main {
return result;
}
/**
* Reads a number of tokens from the user input
* @param max <p>The number of tokens expected.</p>
* @return <p>A list of tokens.</p>
*/
private static List<String> readInput(int max) {
List<String> tokens = tokenizer(in.nextLine());
List<String> tokens = tokenizer(READER.nextLine());
if (max < tokens.size()) {
throw new IllegalArgumentException("Input contains " + tokens.size() +
" arguments, but the input only supports " + max + " arguments.");
@ -223,27 +270,40 @@ public class Main {
return tokens;
}
private static String getChoice(String prompt) {
System.out.println(prompt);
/**
* Gets the user's choice
* @param prompt <p>The prompt shown to the user.</p>
* @return <p>The non-empty choice given by the user.</p>
* @throws IOException <p>If the reader can't be read.</p>
*/
private static String getChoice(String prompt) throws IOException {
printl(prompt);
String choice = "";
while (choice.equals("")) {
System.out.println("Your input: ");
choice = in.nextLine();
printl("Your input: ");
choice = READER.nextLine();
}
return choice;
}
private static int getChoice(String prompt, int min, int max) {
System.out.println(prompt);
/**
* Gets an integer from the user
* @param prompt The prompt to give the user
* @param min The minimum allowed value
* @param max The maximum allowed value
* @return The value given by the user
*/
private static int getChoice(String prompt, int min, int max) throws IOException {
printl(prompt);
int choice = 0;
while (choice < min || choice > max) {
System.out.println("Your input: ");
printl("Your input: ");
try {
choice = Integer.parseInt(in.next());
choice = Integer.parseInt(READER.next());
} catch (NumberFormatException e) {
System.out.println("Invalid choice. Please try again.");
printl("Invalid choice. Please try again.");
} finally {
in.nextLine();
READER.nextLine();
}
}
return choice;

View File

@ -46,11 +46,14 @@ public class AnimeConverter extends Converter {
*/
private void processFile(File folder, File file) throws IOException {
List<StreamObject> streams = probeFile(ffprobePath, file);
if (streams.size() == 0) {
if (streams.isEmpty()) {
throw new IllegalArgumentException("The file has no valid streams. Please make sure the file exists and is not corrupt.");
}
String newPath = fileCollisionPrevention(folder.getAbsolutePath() + File.separator + stripExtension(file) + ".mp4", "mp4");
convertProcess(new ProcessBuilder(builderCommand(ffmpegPath, file.getName(), streams, newPath)), folder);
printl("Preparing to start process...");
String[] command = builderCommand(ffmpegPath, file.getName(), streams, newPath);
ProcessBuilder processBuilder = new ProcessBuilder(command);
convertProcess(processBuilder, folder);
}
/**

View File

@ -6,9 +6,11 @@ import ffmpegconverter.streams.SubtitleStream;
import ffmpegconverter.streams.VideoStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Iterator;
@ -21,6 +23,8 @@ import java.util.function.Predicate;
public abstract class Converter {
String ffprobePath;
String ffmpegPath;
private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
private static final String PROBE_SPLIT_CHARACTER = "øæåÆØå";
@ -51,7 +55,8 @@ public abstract class Converter {
"stream_tags=language,title:stream=index,codec_name,codec_type,channels",
file.toString()
);
System.out.println(builderProbe.command());
print("Probe command: ");
printl(builderProbe.command().toString());
builderProbe.redirectErrorStream(true);
Process processProbe = builderProbe.start();
BufferedReader readerProbe = new BufferedReader(new InputStreamReader(processProbe.getInputStream()));
@ -59,7 +64,7 @@ public abstract class Converter {
while (processProbe.isAlive()) {
String read = read(readerProbe, PROBE_SPLIT_CHARACTER);
if (!read.equals("")) {
System.out.print(read);
print(read);
output.append(read);
}
}
@ -82,7 +87,8 @@ public abstract class Converter {
* @throws IOException If the process can't be read
*/
static void convertProcess(ProcessBuilder process, File folder) throws IOException {
System.out.println(process.command());
print("Command to be run: ");
printl(process.command().toString());
process.directory(folder);
process.redirectErrorStream(true);
Process processConvert = process.start();
@ -90,9 +96,10 @@ public abstract class Converter {
while (processConvert.isAlive()) {
String read = read(readerConvert, "\n");
if (!read.equals("")) {
System.out.println(read);
printl(read);
}
}
printl("FFMPEG is finished.");
}
/**
@ -416,4 +423,19 @@ public abstract class Converter {
}
return new SubtitleStream(codecName, absoluteIndex, relativeIndex, language, title);
}
static void print(String input) throws IOException {
if (!input.equals("")) {
writer.write(input);
writer.flush();
}
}
static void printl(String input) throws IOException {
if (!input.equals("")) {
writer.write(input);
}
writer.newLine();
writer.flush();
}
}

View File

@ -4,10 +4,10 @@ package ffmpegconverter.streams;
* An object representation of a subtitle stream in a media file
*/
public class SubtitleStream extends StreamObject {
private String language;
private String title; //Title shown
private boolean isFullSubtitle; //Songs and signs will be false
private boolean isImageSubtitle;
final private String language;
final private String title; //Title shown
final private boolean isFullSubtitle; //Songs and signs will be false
final private boolean isImageSubtitle;
public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title) {
this.codecType = "subtitle";
@ -36,9 +36,15 @@ public class SubtitleStream extends StreamObject {
if (getTitle() == null) {
return false;
}
String title = getTitle().toLowerCase();
return !(title.contains("songs and signs") || title.contains("songs & signs") || title.contains("songs ") ||
title.contains("signs/songs") || title.contains("[forced]") || title.contains("(forced)"));
String titleLowercase = getTitle().toLowerCase();
return !(titleLowercase.contains("songs and signs") ||
titleLowercase.contains("signs and songs") ||
titleLowercase.contains("songs & signs") ||
titleLowercase.contains("signs & songs") ||
titleLowercase.contains("signs/song") ||
titleLowercase.contains("songs/sign") ||
titleLowercase.contains("[forced]") ||
titleLowercase.contains("(forced)"));
}
public String getLanguage() {