From d7cd74bfaf1ea7aa98bb2d05b727c20744524af2 Mon Sep 17 00:00:00 2001 From: RatzzFatzz Date: Tue, 21 Feb 2023 14:56:16 +0100 Subject: [PATCH] Update README.md --- README.md | 84 ++++++++----------- config-template.yaml | 12 ++- .../validator/AttributeConfigValidator.java | 3 +- .../model/ConfigProperty.java | 4 +- .../util/LanguageValidatorUtil.java | 4 + .../config/validator/SetValidatorTest.java | 1 + 6 files changed, 57 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 3ac781c..3eb72bf 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,49 @@ -### Table of content - - Introduction - - Requirements - - Running - - Configuration - - Additional parameters - -### Introduction +## Introduction -This program helps to change audio and subtitle lines of mkv files. +This program helps to change audio and subtitle tracks of mkv files without rewriting the file. Only track properties will be updated. -### Requirements +## Requirements - Java 11 or higher - mkvtoolnix installation -### Running +## Execution +**Minimal usage:** +`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF` -1. Extract downloaded archive -2. Copy `config-template.yaml` to `config.yaml` -3. Update `config.yaml` to fit your needs -4. Open terminal / cmd in the directory of the jar and the config file -5. Execute following commands: - 1. (Optional) `java -jar mkvaudiosubtitleschanger.jar -l [path to mkv or dir with mkv] --safe-mode` - 2. To permanently apply changes: `java -jar mkvaudiosubtitleschanger.jar -l [path to mkv or dir with mkv]` +**Safe usage (best for testing before applying to whole library):** +`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode` -### Configuration +Attribute-config must be entered in pairs: `audio:subtitle`; Example: `jpn:eng`. More about this topic +[here](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Attribute-Config). -Config file needs to be placed in the same directory as the jar or path to config has to be passed via command line -argument. - -The list of language configurations can be expanded. Use `OFF` if you want to turn of the audio or subtitle lane. -Players probably will display forced subtitles nonetheless. -```yaml -config: - 1: - audio: ger - subtitle: OFF - 2: - audio: eng - subtitle: ger +## Available parameters +```shell + -l,--library Path to library + -a,--attribute-config Attribute config to decide which tracks to choose when + -p,--config-path Path to config file + -m,--mkvtoolnix Path to mkv tool nix installation + -s,--safe-mode Test run (no files will be changes) + -t,--threads Thread count (default: 2) + -i,--include-pattern Include files matching pattern (default: ".*") + -e,--exclude-directories Directories to be excluded, combines with config file + -fk,--forced-keywords Additional keywords to identify forced tracks + -ck,--commentary-keywords Additional keywords to identify commentary tracks + -v,--version Display version + -h,--help "For help this is" - Yoda ``` -Subtitle lanes recognized as forced will be set as one. Already existing ones will not be overwritten or changed. +All parameters can also be defined in a config file. +Please read [this wiki page](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/How-to-config-file) for more information. -### Additional arameters -These properties overwrite already existing values in the config file. -```properties - -c,--config Path to config file - -e,--exclude-directories Directories to be excluded, combines with config file - -h,--help "for help this is" - Yoda - -i,--include-pattern Include files matching pattern - -k,--forcedKeywords Additional keywords to identify forced tracks, combines with config file - -l,--library Path to library - -m,--mkvtoolnix Path to mkv tool nix installation - -s,--safe-mode Test run (no files will be changes) - -t,--threads thread count (default: 2) - -v,--version Display version -``` \ No newline at end of file +## Build requirements +- JDK 11 or higher +- Maven 3 +- Git + +## Build from source +```shell +git clone https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git +cd MKVAudioSubtitleChanger +mvn package +``` diff --git a/config-template.yaml b/config-template.yaml index 5647685..2cc5d38 100644 --- a/config-template.yaml +++ b/config-template.yaml @@ -1,4 +1,5 @@ mkvtoolnix: C:\Program Files\MKVToolNix +library: X:/Files config: 1: @@ -10,9 +11,18 @@ config: # Recommendations for data stored on HDDs, increase when using SSDs #threads: 2 -#forcedKeywords: ["forced", "signs"] + +#forced-keywords: ["forced", "signs"] +#commentary-keywords: ["commentary", "director"] + #exclude-directories: # - "D:/Path/To/File.mkv" # - "D:/Path/To/Directory" + +# If pattern is negated, can be used to exclude files #include-pattern: "regex" +safe-mode: +#coherent: + + diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/validator/AttributeConfigValidator.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/validator/AttributeConfigValidator.java index 0f5ba62..7342c9f 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/validator/AttributeConfigValidator.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/validator/AttributeConfigValidator.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; +import static at.pcgamingfreaks.mkvaudiosubtitlechanger.util.LanguageValidatorUtil.isAudioLanguageValid; import static at.pcgamingfreaks.mkvaudiosubtitlechanger.util.LanguageValidatorUtil.isLanguageValid; public class AttributeConfigValidator extends ConfigValidator> { @@ -78,7 +79,7 @@ public class AttributeConfigValidator extends ConfigValidator