mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-10 17:55:57 +01:00
84
README.md
84
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 <arg> Path to library
|
||||
-a,--attribute-config <arg> Attribute config to decide which tracks to choose when
|
||||
-p,--config-path <arg> Path to config file
|
||||
-m,--mkvtoolnix <arg> Path to mkv tool nix installation
|
||||
-s,--safe-mode Test run (no files will be changes)
|
||||
-t,--threads <arg> Thread count (default: 2)
|
||||
-i,--include-pattern <arg> Include files matching pattern (default: ".*")
|
||||
-e,--exclude-directories <arg> Directories to be excluded, combines with config file
|
||||
-fk,--forced-keywords <arg> Additional keywords to identify forced tracks
|
||||
-ck,--commentary-keywords <arg> 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 <arg> Path to config file
|
||||
-e,--exclude-directories <arg> Directories to be excluded, combines with config file
|
||||
-h,--help "for help this is" - Yoda
|
||||
-i,--include-pattern <arg> Include files matching pattern
|
||||
-k,--forcedKeywords <arg> Additional keywords to identify forced tracks, combines with config file
|
||||
-l,--library <arg> Path to library
|
||||
-m,--mkvtoolnix <arg> Path to mkv tool nix installation
|
||||
-s,--safe-mode Test run (no files will be changes)
|
||||
-t,--threads <arg> thread count (default: 2)
|
||||
-v,--version Display version
|
||||
```
|
||||
## 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
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
|
||||
@@ -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<List<AttributeConfig>> {
|
||||
@@ -78,7 +79,7 @@ public class AttributeConfigValidator extends ConfigValidator<List<AttributeConf
|
||||
}
|
||||
boolean isValid;
|
||||
for (AttributeConfig attributeConfig : result) {
|
||||
isValid = isLanguageValid(attributeConfig.getAudioLanguage())
|
||||
isValid = isAudioLanguageValid(attributeConfig.getAudioLanguage())
|
||||
&& isLanguageValid(attributeConfig.getSubtitleLanguage());
|
||||
if (!isValid) return false;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ public enum ConfigProperty {
|
||||
CONFIG_PATH("config-path", "Path to config file", "p", 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),
|
||||
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),
|
||||
THREADS("threads", "Thread count (default: 2)", "t", 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),
|
||||
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),
|
||||
ARGUMENTS("arguments", "List of arguments", null, 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) {
|
||||
return ISO3_LANGUAGES.contains(language);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ class SetValidatorTest {
|
||||
return Stream.of(
|
||||
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() + ":\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, false, "", new String[]{"-ck", "test"}, VALID, 1),
|
||||
argumentsOf(COMMENTARY_KEYWORDS, true, true, COMMENTARY_KEYWORDS.prop() + ": [commentary]", new String[]{}, VALID, 2),
|
||||
|
||||
Reference in New Issue
Block a user