mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Update README.md
This commit is contained in:
82
README.md
82
README.md
@@ -1,59 +1,49 @@
|
|||||||
### Table of content
|
## Introduction
|
||||||
- Introduction
|
|
||||||
- Requirements
|
|
||||||
- Running
|
|
||||||
- Configuration
|
|
||||||
- Additional parameters
|
|
||||||
|
|
||||||
### Introduction
|
This program helps to change audio and subtitle tracks of mkv files without rewriting the file. Only track properties will be updated.
|
||||||
|
|
||||||
This program helps to change audio and subtitle lines of mkv files.
|
## Requirements
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
- Java 11 or higher
|
- Java 11 or higher
|
||||||
- mkvtoolnix installation
|
- mkvtoolnix installation
|
||||||
|
|
||||||
### Running
|
## Execution
|
||||||
|
**Minimal usage:**
|
||||||
|
`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
||||||
|
|
||||||
1. Extract downloaded archive
|
**Safe usage (best for testing before applying to whole library):**
|
||||||
2. Copy `config-template.yaml` to `config.yaml`
|
`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
||||||
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]`
|
|
||||||
|
|
||||||
### 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
|
## Available parameters
|
||||||
argument.
|
```shell
|
||||||
|
-l,--library <arg> Path to library
|
||||||
The list of language configurations can be expanded. Use `OFF` if you want to turn of the audio or subtitle lane.
|
-a,--attribute-config <arg> Attribute config to decide which tracks to choose when
|
||||||
Players probably will display forced subtitles nonetheless.
|
-p,--config-path <arg> Path to config file
|
||||||
```yaml
|
-m,--mkvtoolnix <arg> Path to mkv tool nix installation
|
||||||
config:
|
-s,--safe-mode Test run (no files will be changes)
|
||||||
1:
|
-t,--threads <arg> Thread count (default: 2)
|
||||||
audio: ger
|
-i,--include-pattern <arg> Include files matching pattern (default: ".*")
|
||||||
subtitle: OFF
|
-e,--exclude-directories <arg> Directories to be excluded, combines with config file
|
||||||
2:
|
-fk,--forced-keywords <arg> Additional keywords to identify forced tracks
|
||||||
audio: eng
|
-ck,--commentary-keywords <arg> Additional keywords to identify commentary tracks
|
||||||
subtitle: ger
|
-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
|
## Build requirements
|
||||||
These properties overwrite already existing values in the config file.
|
- JDK 11 or higher
|
||||||
```properties
|
- Maven 3
|
||||||
-c,--config <arg> Path to config file
|
- Git
|
||||||
-e,--exclude-directories <arg> Directories to be excluded, combines with config file
|
|
||||||
-h,--help "for help this is" - Yoda
|
## Build from source
|
||||||
-i,--include-pattern <arg> Include files matching pattern
|
```shell
|
||||||
-k,--forcedKeywords <arg> Additional keywords to identify forced tracks, combines with config file
|
git clone https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
|
||||||
-l,--library <arg> Path to library
|
cd MKVAudioSubtitleChanger
|
||||||
-m,--mkvtoolnix <arg> Path to mkv tool nix installation
|
mvn package
|
||||||
-s,--safe-mode Test run (no files will be changes)
|
|
||||||
-t,--threads <arg> thread count (default: 2)
|
|
||||||
-v,--version Display version
|
|
||||||
```
|
```
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
mkvtoolnix: C:\Program Files\MKVToolNix
|
mkvtoolnix: C:\Program Files\MKVToolNix
|
||||||
|
library: X:/Files
|
||||||
|
|
||||||
config:
|
config:
|
||||||
1:
|
1:
|
||||||
@@ -10,9 +11,18 @@ config:
|
|||||||
|
|
||||||
# Recommendations for data stored on HDDs, increase when using SSDs
|
# Recommendations for data stored on HDDs, increase when using SSDs
|
||||||
#threads: 2
|
#threads: 2
|
||||||
#forcedKeywords: ["forced", "signs"]
|
|
||||||
|
#forced-keywords: ["forced", "signs"]
|
||||||
|
#commentary-keywords: ["commentary", "director"]
|
||||||
|
|
||||||
#exclude-directories:
|
#exclude-directories:
|
||||||
# - "D:/Path/To/File.mkv"
|
# - "D:/Path/To/File.mkv"
|
||||||
# - "D:/Path/To/Directory"
|
# - "D:/Path/To/Directory"
|
||||||
|
|
||||||
|
# If pattern is negated, can be used to exclude files
|
||||||
#include-pattern: "regex"
|
#include-pattern: "regex"
|
||||||
|
|
||||||
|
safe-mode:
|
||||||
|
#coherent:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static at.pcgamingfreaks.mkvaudiosubtitlechanger.util.LanguageValidatorUtil.isAudioLanguageValid;
|
||||||
import static at.pcgamingfreaks.mkvaudiosubtitlechanger.util.LanguageValidatorUtil.isLanguageValid;
|
import static at.pcgamingfreaks.mkvaudiosubtitlechanger.util.LanguageValidatorUtil.isLanguageValid;
|
||||||
|
|
||||||
public class AttributeConfigValidator extends ConfigValidator<List<AttributeConfig>> {
|
public class AttributeConfigValidator extends ConfigValidator<List<AttributeConfig>> {
|
||||||
@@ -78,7 +79,7 @@ public class AttributeConfigValidator extends ConfigValidator<List<AttributeConf
|
|||||||
}
|
}
|
||||||
boolean isValid;
|
boolean isValid;
|
||||||
for (AttributeConfig attributeConfig : result) {
|
for (AttributeConfig attributeConfig : result) {
|
||||||
isValid = isLanguageValid(attributeConfig.getAudioLanguage())
|
isValid = isAudioLanguageValid(attributeConfig.getAudioLanguage())
|
||||||
&& isLanguageValid(attributeConfig.getSubtitleLanguage());
|
&& isLanguageValid(attributeConfig.getSubtitleLanguage());
|
||||||
if (!isValid) return false;
|
if (!isValid) return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ public enum ConfigProperty {
|
|||||||
CONFIG_PATH("config-path", "Path to config file", "p", 1),
|
CONFIG_PATH("config-path", "Path to config file", "p", 1),
|
||||||
MKV_TOOL_NIX("mkvtoolnix", "Path to mkv tool nix installation", "m", 1),
|
MKV_TOOL_NIX("mkvtoolnix", "Path to mkv tool nix installation", "m", 1),
|
||||||
SAFE_MODE("safe-mode", "Test run (no files will be changes)", "s", 0),
|
SAFE_MODE("safe-mode", "Test run (no files will be changes)", "s", 0),
|
||||||
COHERENT("coherent", "Try to match whole series with same config", "c", 0),
|
COHERENT("coherent", "Try to match whole series with same config", null, 0),
|
||||||
WINDOWS("windows", "Is operating system windows", null, 0),
|
WINDOWS("windows", "Is operating system windows", null, 0),
|
||||||
THREADS("threads", "Thread count (default: 2)", "t", 1),
|
THREADS("threads", "Thread count (default: 2)", "t", 1),
|
||||||
INCLUDE_PATTERN("include-pattern", "Include files matching pattern (default: \".*\")", "i", 1),
|
INCLUDE_PATTERN("include-pattern", "Include files matching pattern (default: \".*\")", "i", 1),
|
||||||
EXCLUDE_DIRECTORY("exclude-directories", "Directories to be excluded, combines with config file", "e", 1),
|
EXCLUDE_DIRECTORY("exclude-directories", "Directories to be excluded, combines with config file", "e", 1),
|
||||||
FORCED_KEYWORDS("forcedKeywords", "Additional keywords to identify forced tracks", "fk", Option.UNLIMITED_VALUES),
|
FORCED_KEYWORDS("forced-keywords", "Additional keywords to identify forced tracks", "fk", Option.UNLIMITED_VALUES),
|
||||||
COMMENTARY_KEYWORDS("commentary-keywords", "Additional keywords to identify commentary tracks", "ck", Option.UNLIMITED_VALUES),
|
COMMENTARY_KEYWORDS("commentary-keywords", "Additional keywords to identify commentary tracks", "ck", Option.UNLIMITED_VALUES),
|
||||||
ARGUMENTS("arguments", "List of arguments", null, 0),
|
ARGUMENTS("arguments", "List of arguments", null, 0),
|
||||||
VERSION("version", "Display version", "v", 0),
|
VERSION("version", "Display version", "v", 0),
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ public class LanguageValidatorUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isAudioLanguageValid(String language) {
|
||||||
|
return !language.equals("OFF") && ISO3_LANGUAGES.contains(language);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLanguageValid(String language) {
|
public static boolean isLanguageValid(String language) {
|
||||||
return ISO3_LANGUAGES.contains(language);
|
return ISO3_LANGUAGES.contains(language);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class SetValidatorTest {
|
|||||||
return Stream.of(
|
return Stream.of(
|
||||||
argumentsOf(COMMENTARY_KEYWORDS, true, true, "", new String[]{"-ck", "test"}, VALID, 3),
|
argumentsOf(COMMENTARY_KEYWORDS, true, true, "", new String[]{"-ck", "test"}, VALID, 3),
|
||||||
argumentsOf(COMMENTARY_KEYWORDS, true, false, COMMENTARY_KEYWORDS.prop() + ": [test]", new String[]{}, VALID, 1),
|
argumentsOf(COMMENTARY_KEYWORDS, true, false, COMMENTARY_KEYWORDS.prop() + ": [test]", new String[]{}, VALID, 1),
|
||||||
|
argumentsOf(COMMENTARY_KEYWORDS, true, false, COMMENTARY_KEYWORDS.prop() + ":\n - test\n - test2", new String[]{}, VALID, 2),
|
||||||
argumentsOf(COMMENTARY_KEYWORDS, false, true, COMMENTARY_KEYWORDS.prop() + ": [test]", new String[]{}, VALID, 3),
|
argumentsOf(COMMENTARY_KEYWORDS, false, true, COMMENTARY_KEYWORDS.prop() + ": [test]", new String[]{}, VALID, 3),
|
||||||
argumentsOf(COMMENTARY_KEYWORDS, false, false, "", new String[]{"-ck", "test"}, VALID, 1),
|
argumentsOf(COMMENTARY_KEYWORDS, false, false, "", new String[]{"-ck", "test"}, VALID, 1),
|
||||||
argumentsOf(COMMENTARY_KEYWORDS, true, true, COMMENTARY_KEYWORDS.prop() + ": [commentary]", new String[]{}, VALID, 2),
|
argumentsOf(COMMENTARY_KEYWORDS, true, true, COMMENTARY_KEYWORDS.prop() + ": [commentary]", new String[]{}, VALID, 2),
|
||||||
|
|||||||
Reference in New Issue
Block a user