mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 18:15:57 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c33777b038 | ||
|
|
6c08ce69ea | ||
|
|
7f8c14e3a9 | ||
|
|
553c672e4d | ||
|
|
d98c4cd49e | ||
|
|
21f244ff3f | ||
|
|
ffac36ac27 | ||
|
|
0813744148 | ||
|
|
44d2601d3e |
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
@@ -20,11 +20,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
timezoneLinux: "Europe/Berlin"
|
timezoneLinux: "Europe/Berlin"
|
||||||
|
|
||||||
- name: Set up JDK 21
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4.7.0
|
uses: actions/setup-java@v4.7.0
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 21
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup workspace
|
- name: Setup workspace
|
||||||
run: mkdir artifacts
|
run: mkdir artifacts
|
||||||
@@ -41,6 +41,41 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
args: 'artifacts/M*'
|
args: 'artifacts/M*'
|
||||||
|
|
||||||
|
debian-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install mkvtoolnix
|
||||||
|
run: sudo apt-get install -y mkvtoolnix
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set timezone
|
||||||
|
uses: szenius/set-timezone@v2.0
|
||||||
|
with:
|
||||||
|
timezoneLinux: "Europe/Berlin"
|
||||||
|
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v4.7.0
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Setup workspace
|
||||||
|
run: mkdir artifacts
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: |
|
||||||
|
mvn clean package --file pom.xml -P linux
|
||||||
|
cp target/M*.deb artifacts/
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: skx/github-action-publish-binaries@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: 'artifacts/M*'
|
||||||
|
|
||||||
windows-installer-build:
|
windows-installer-build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -57,11 +92,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
timezoneWindows: "Berlin Standard Time"
|
timezoneWindows: "Berlin Standard Time"
|
||||||
|
|
||||||
- name: Set up JDK 21
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4.7.0
|
uses: actions/setup-java@v4.7.0
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 21
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup workspace
|
- name: Setup workspace
|
||||||
run: mkdir artifacts
|
run: mkdir artifacts
|
||||||
|
|||||||
71
README.md
71
README.md
@@ -1,49 +1,62 @@
|
|||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
This program helps to change audio and subtitle tracks of mkv files without rewriting the file. Only track properties will be updated.
|
A streamlined solution for managing MKV files, this program leverages MKVToolNix to modify audio and subtitle track properties without the need for time-consuming file reencoding. Users can easily set their track preferences, and the application intelligently applies the best matching configuration. The tool focuses on metadata modification rather than full file rewriting, ensuring quick operations while maintaining the original file integrity. This makes it an ideal choice for managing multilingual media collections or batch processing multiple MKV files.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Java 11 or higher
|
- Java 21 or newer
|
||||||
- mkvtoolnix installation
|
- mkvtoolnix installation
|
||||||
|
|
||||||
## Execution
|
## Execution
|
||||||
**Minimal usage:**
|
### Minimal usage
|
||||||
`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
||||||
|
|
||||||
**Safe usage (best for testing before applying to whole library):**
|
Windows (installed): `mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
||||||
`java -jar mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
|
||||||
|
|
||||||
Attribute-config must be entered in pairs: `audio:subtitle`; Example: `jpn:eng`. More about this topic
|
### Safe usage (best for testing before applying to whole library)
|
||||||
[here](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Attribute-Config).
|
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
||||||
|
|
||||||
|
Windows (installed): `mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
||||||
|
|
||||||
|
**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).**
|
||||||
|
|
||||||
## Available parameters
|
## Available parameters
|
||||||
```
|
```
|
||||||
-l,--library-path <arg> Path to library
|
-a, --attribute-config=<attributeConfig>...
|
||||||
-a,--attribute-config <arg> Attribute config to decide which tracks to choose when
|
List of audio:subtitle pairs used to match in order and update files accordingly (e.g. jpn:eng jpn:ger)
|
||||||
-p,--config-path <arg> Path to config file
|
-c, --coherent=<coherent> try to match all files in dir of depth with the same attribute config
|
||||||
-m,--mkvtoolnix <arg> Path to mkv tool nix installation
|
-cf, --force-coherent changes are only applied if it's a coherent match
|
||||||
-s,--safe-mode Test run (no files will be changes)
|
--commentary-keywords=<commentaryKeywords>[, <commentaryKeywords>...]...
|
||||||
-c,--coherent <arg> Try to match all files in dir of depth with the same config
|
Keywords to identify commentary tracks (Defaults will be overwritten; Default: commentary, director)
|
||||||
-cf,--force-coherent Force coherent and don't update anything if config fits not whole config (default: false)
|
-d, --filter-date=<filterDate>
|
||||||
-n,--only-new-files Sets filter-date to last successful execution (Overwrites input of filter-date)
|
only consider files created newer than entered date (format: "dd.MM.yyyy-HH:mm:ss")
|
||||||
-d,--filter-date <arg> Only consider files created newer than entered date (format: "dd.MM.yyyy-HH:mm:ss")
|
-e, --excluded-directory=<excludedDirectories>...
|
||||||
-t,--threads <arg> Thread count (default: 2)
|
Directories to be excluded, combines with config file
|
||||||
-i,--include-pattern <arg> Include files matching pattern (default: ".*")
|
--forced-keywords=<forcedKeywords>[, <forcedKeywords>...]...
|
||||||
-e,--excluded-directories <arg> Directories to be excluded, combines with config file
|
Keywords to identify forced tracks (Defaults will be overwritten; Default: forced, signs, songs)
|
||||||
-fk,--forced-keywords <arg> Additional keywords to identify forced tracks
|
-h, --help Show this help message and exit.
|
||||||
-ck,--commentary-keywords <arg> Additional keywords to identify commentary tracks
|
-i, --include-pattern=<includePattern>
|
||||||
-ps,--preferred-subtitles <arg> Additional keywords to prefer specific subtitle tracks
|
include files matching pattern (default: ".*")
|
||||||
-v,--version Display version
|
-l, --library=<libraryPath>
|
||||||
-h,--help "For help this is" - Yoda
|
path to library
|
||||||
|
-m, --mkvtoolnix=<mkvToolNix>
|
||||||
|
path to mkvtoolnix installation
|
||||||
|
-n, --only-new-file sets filter-date to last successful execution (overwrites input of filter-date)
|
||||||
|
--preferred-subtitles=<preferredSubtitles>[, <preferredSubtitles>...]...
|
||||||
|
Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: unstyled)
|
||||||
|
-s, --safemode test run (no files will be changes)
|
||||||
|
-t, --threads=<threads> thread count (default: 2)
|
||||||
|
-V, --version Print version information and exit.
|
||||||
```
|
```
|
||||||
If you need more information about how each parameter works, check out [this wiki page](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Parameters).
|
If you need more information how each parameter works, check out [this wiki page](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Parameters-v4).
|
||||||
|
|
||||||
All parameters can also be defined in a [config file](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/How-to-config-file).
|
All parameters can also be defined in a [config file](https://picocli.info/#_argument_files_for_long_command_lines).
|
||||||
|
|
||||||
## Build requirements
|
## Build requirements
|
||||||
- JDK 11 or higher
|
- JDK 21 or newer
|
||||||
- Maven 3
|
- Maven 3
|
||||||
- Git
|
- Git
|
||||||
|
|
||||||
@@ -51,5 +64,5 @@ All parameters can also be defined in a [config file](https://github.com/RatzzFa
|
|||||||
```shell
|
```shell
|
||||||
git clone https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
|
git clone https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
|
||||||
cd MKVAudioSubtitleChanger
|
cd MKVAudioSubtitleChanger
|
||||||
mvn package
|
mvn clean package -Pportable
|
||||||
```
|
```
|
||||||
|
|||||||
BIN
example.gif
BIN
example.gif
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 31 KiB |
180
pom.xml
180
pom.xml
@@ -11,6 +11,11 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
||||||
|
|
||||||
|
<project.maintainer>RatzzFatzz</project.maintainer>
|
||||||
|
<project.maintainer.mail>github.contact@ratzloeffel.de</project.maintainer.mail>
|
||||||
|
<project.description>Command-line utility for batch-managing default audio and subtitle tracks in MKV files.</project.description>
|
||||||
|
|
||||||
|
<java-version>17</java-version>
|
||||||
<lombok-version>1.18.36</lombok-version>
|
<lombok-version>1.18.36</lombok-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -66,24 +71,70 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.3.1</version>
|
<version>3.3.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-jpackage-input</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/jpackage-input</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>${project.artifactId}-${project.version}.jar</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>filter-windows-installer-info</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/wix-resources</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${project.basedir}/src/wix/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.panteleyev</groupId>
|
<groupId>org.panteleyev</groupId>
|
||||||
<artifactId>jpackage-maven-plugin</artifactId>
|
<artifactId>jpackage-maven-plugin</artifactId>
|
||||||
<version>1.6.5</version>
|
<version>1.6.5</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>windows</id>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<resourceDir>${project.basedir}/src/main/resources/</resourceDir>
|
<name>${project.artifactId}</name>
|
||||||
|
<vendor>RatzzFatzz</vendor>
|
||||||
|
<appVersion>${project.version}</appVersion>
|
||||||
|
|
||||||
|
<destination>target/installer</destination>
|
||||||
|
|
||||||
|
<input>target/jpackage-input</input>
|
||||||
|
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
||||||
|
<mainJar>${project.artifactId}-${project.version}.jar</mainJar>
|
||||||
|
|
||||||
|
<resourceDir>${project.build.directory}/wix-resources/</resourceDir>
|
||||||
<type>EXE</type>
|
<type>EXE</type>
|
||||||
<winConsole>true</winConsole>
|
<winConsole>true</winConsole>
|
||||||
<winShortcut>false</winShortcut>
|
<winShortcut>false</winShortcut>
|
||||||
<winMenu>false</winMenu>
|
<winMenu>false</winMenu>
|
||||||
<javaOptions>
|
<javaOptions>
|
||||||
<javaOption>-Dlog4j.configurationFile=log4j2-installed.yaml</javaOption>
|
<javaOption>-Dlog4j.configurationFile=log4j2-windows.yaml</javaOption>
|
||||||
</javaOptions>
|
</javaOptions>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>windows</id>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jpackage</goal>
|
<goal>jpackage</goal>
|
||||||
@@ -97,25 +148,71 @@
|
|||||||
<profile>
|
<profile>
|
||||||
<id>linux</id>
|
<id>linux</id>
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>log4j2-debian.yaml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.panteleyev</groupId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<artifactId>jpackage-maven-plugin</artifactId>
|
<version>3.3.1</version>
|
||||||
<version>1.4.0</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>linux-deb</id>
|
<id>filter-linux-package-info</id>
|
||||||
<configuration>
|
|
||||||
<type>DEB</type>
|
|
||||||
<installDir>/usr/local/bin</installDir>
|
|
||||||
<linuxShortcut>false</linuxShortcut>
|
|
||||||
<linuxPackageName>mkvasc</linuxPackageName>
|
|
||||||
<linuxDebMaintainer>your@email.com</linuxDebMaintainer>
|
|
||||||
</configuration>
|
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jpackage</goal>
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/debian-package-info</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${project.basedir}/src/deb</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>jdeb</artifactId>
|
||||||
|
<groupId>org.vafer</groupId>
|
||||||
|
<version>1.13</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jdeb</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<dataSet>
|
||||||
|
<!-- JAR file -->
|
||||||
|
<data>
|
||||||
|
<src>${project.build.directory}/${project.build.finalName}.jar</src>
|
||||||
|
<type>file</type>
|
||||||
|
<mapper>
|
||||||
|
<type>perm</type>
|
||||||
|
<prefix>/usr/lib/${project.artifactId}</prefix>
|
||||||
|
</mapper>
|
||||||
|
</data>
|
||||||
|
<!-- Launcher script -->
|
||||||
|
<data>
|
||||||
|
<src>${project.build.directory}/debian-package-info/bin/mkvaudiosubtitlechanger</src>
|
||||||
|
<type>file</type>
|
||||||
|
<mapper>
|
||||||
|
<type>perm</type>
|
||||||
|
<prefix>/usr/bin</prefix>
|
||||||
|
<filemode>755</filemode>
|
||||||
|
</mapper>
|
||||||
|
</data>
|
||||||
|
</dataSet>
|
||||||
|
<controlDir>${project.build.directory}/debian-package-info/control</controlDir>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
@@ -197,8 +294,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>21</source>
|
<source>${java-version}</source>
|
||||||
<target>21</target>
|
<target>${java-version}</target>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
|
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
@@ -218,51 +315,6 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
|
||||||
<version>3.3.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>copy-jpackage-input</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>copy-resources</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${project.build.directory}/jpackage-input</outputDirectory>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>${project.build.directory}</directory>
|
|
||||||
<includes>
|
|
||||||
<include>${project.artifactId}-${project.version}.jar</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.panteleyev</groupId>
|
|
||||||
<artifactId>jpackage-maven-plugin</artifactId>
|
|
||||||
<version>1.4.0</version>
|
|
||||||
<configuration>
|
|
||||||
<name>${project.artifactId}</name>
|
|
||||||
<vendor>RatzzFatzz</vendor>
|
|
||||||
<appVersion>${project.version}</appVersion>
|
|
||||||
|
|
||||||
<destination>target/installer</destination>
|
|
||||||
|
|
||||||
<input>target/jpackage-input</input>
|
|
||||||
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
|
||||||
<mainJar>${project.artifactId}-${project.version}.jar</mainJar>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
1
src/deb/bin/mkvaudiosubtitlechanger
Normal file
1
src/deb/bin/mkvaudiosubtitlechanger
Normal file
@@ -0,0 +1 @@
|
|||||||
|
java -Dlog4j.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"
|
||||||
8
src/deb/control/control
Normal file
8
src/deb/control/control
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Package: ${project.artifactId}
|
||||||
|
Version: ${project.version}
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: java-runtime (>=${java-version}), mkvtoolnix
|
||||||
|
Maintainer: ${project.maintainer} <${project.maintainer.mail}>
|
||||||
|
Description: ${project.description}
|
||||||
@@ -18,11 +18,12 @@ import java.util.Set;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@CommandLine.Command(
|
@CommandLine.Command(
|
||||||
name = "mkvasc",
|
name = "mkvaudiosubtitlechanger",
|
||||||
usageHelpWidth = 120,
|
usageHelpWidth = 120,
|
||||||
customSynopsis = {
|
customSynopsis = {
|
||||||
"mkvasc -a <attributeConfig>... -l <libraryPath> [-s]",
|
"mkvaudiosubtitlechanger -a <attributeConfig>... -l <libraryPath> [-s]",
|
||||||
"Example: mkvasc -a eng:eng eng:ger -l /mnt/media/ -s"
|
"Example: mkvaudiosubtitlechanger -a eng:eng eng:ger -l /mnt/media/ -s",
|
||||||
|
""
|
||||||
},
|
},
|
||||||
mixinStandardHelpOptions = true,
|
mixinStandardHelpOptions = true,
|
||||||
versionProvider = ProjectUtil.class
|
versionProvider = ProjectUtil.class
|
||||||
@@ -60,6 +61,9 @@ public class Main implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
args = new String[] { "--help" };
|
||||||
|
}
|
||||||
new CommandLine(Main.class).execute(args);
|
new CommandLine(Main.class).execute(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public class Config {
|
|||||||
@CommandLine.Spec
|
@CommandLine.Spec
|
||||||
CommandLine.Model.CommandSpec spec;
|
CommandLine.Model.CommandSpec spec;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-a", "--attribute-config"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class)
|
@CommandLine.Option(names = {"-a", "--attribute-config"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class,
|
||||||
|
description = "List of audio:subtitle pairs used to match in order and update files accordingly (e.g. jpn:eng jpn:ger)")
|
||||||
private List<AttributeConfig> attributeConfig;
|
private List<AttributeConfig> attributeConfig;
|
||||||
|
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
@@ -51,7 +52,7 @@ public class Config {
|
|||||||
@CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match")
|
@CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match")
|
||||||
private boolean forceCoherent;
|
private boolean forceCoherent;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-n"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)")
|
@CommandLine.Option(names = {"-n", "--only-new-file"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)")
|
||||||
private boolean onlyNewFiles;
|
private boolean onlyNewFiles;
|
||||||
@CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")")
|
@CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")")
|
||||||
private Date filterDate;
|
private Date filterDate;
|
||||||
@@ -61,15 +62,15 @@ public class Config {
|
|||||||
description = "Directories to be excluded, combines with config file")
|
description = "Directories to be excluded, combines with config file")
|
||||||
private Set<String> excludedDirectories = new HashSet<>();
|
private Set<String> excludedDirectories = new HashSet<>();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-fk", "--force-keywords"}, arity = "1..*",
|
@CommandLine.Option(names = {"--forced-keywords"}, arity = "1..*", defaultValue = "forced, signs, songs", split = ", ",
|
||||||
description = "Additional keywords to identify forced tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
|
description = "Keywords to identify forced tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
|
||||||
private Set<String> forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs"));
|
private Set<String> forcedKeywords;
|
||||||
@CommandLine.Option(names = {"-ck", "--commentary-keywords"}, arity = "1..*",
|
@CommandLine.Option(names = {"--commentary-keywords"}, arity = "1..*", defaultValue = "commentary, director", split = ", ",
|
||||||
description = "Additional keywords to identify commentary tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
|
description = "Keywords to identify commentary tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
|
||||||
private Set<String> commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director"));
|
private Set<String> commentaryKeywords;
|
||||||
@CommandLine.Option(names = {"-ps", "--preferred-subtiltes"}, arity = "1..*",
|
@CommandLine.Option(names = {"--preferred-subtitles"}, arity = "1..*", defaultValue = "unstyled", split = ", ",
|
||||||
description = "Additional keywords to prefer specific subtitle tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
|
description = "Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
|
||||||
private Set<String> preferredSubtitles = new HashSet<>(Arrays.asList("unstyled"));
|
private Set<String> preferredSubtitles;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library")
|
@CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library")
|
||||||
public void setLibraryPath(File libraryPath) {
|
public void setLibraryPath(File libraryPath) {
|
||||||
|
|||||||
34
src/main/resources/log4j2-debian.yaml
Normal file
34
src/main/resources/log4j2-debian.yaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Configuration:
|
||||||
|
name: DefaultLogger
|
||||||
|
Appenders:
|
||||||
|
RollingFile:
|
||||||
|
name: FileAppender
|
||||||
|
fileName: /var/log/MKVAudioSubtitleChanger/application.log
|
||||||
|
filePattern: /var/log/MKVAudioSubtitleChanger/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
|
PatternLayout:
|
||||||
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
||||||
|
ThresholdFilter:
|
||||||
|
level: info
|
||||||
|
Policies:
|
||||||
|
OnStartupTriggeringPolicy:
|
||||||
|
minSize: 0
|
||||||
|
DefaultRolloverStrategy:
|
||||||
|
max: 30
|
||||||
|
Delete:
|
||||||
|
basePath: archive
|
||||||
|
maxDepth: 1
|
||||||
|
IfLastModified:
|
||||||
|
age: 30d
|
||||||
|
IfAccumulatedFileSize:
|
||||||
|
exceeds: 1GB
|
||||||
|
|
||||||
|
Loggers:
|
||||||
|
Root:
|
||||||
|
level: info
|
||||||
|
AppenderRef:
|
||||||
|
- ref: FileAppender
|
||||||
|
Logger:
|
||||||
|
name: "com.zaxxer.hikari.HikariConfig"
|
||||||
|
level: info
|
||||||
|
AppenderRef:
|
||||||
|
- ref: FileAppender
|
||||||
@@ -10,7 +10,7 @@ Configuration:
|
|||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: logs/application.log
|
fileName: logs/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log
|
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
@@ -18,6 +18,16 @@ Configuration:
|
|||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
DefaultRolloverStrategy:
|
||||||
|
max: 30
|
||||||
|
Delete:
|
||||||
|
basePath: logs/archive
|
||||||
|
maxDepth: 1
|
||||||
|
IfLastModified:
|
||||||
|
age: 30d
|
||||||
|
IfAccumulatedFileSize:
|
||||||
|
exceeds: 1GB
|
||||||
|
|
||||||
Loggers:
|
Loggers:
|
||||||
Root:
|
Root:
|
||||||
level: debug
|
level: debug
|
||||||
|
|||||||
@@ -1,17 +1,10 @@
|
|||||||
Configuration:
|
Configuration:
|
||||||
name: DefaultLogger
|
name: DefaultLogger
|
||||||
Appenders:
|
Appenders:
|
||||||
File:
|
|
||||||
name: FileAppender
|
|
||||||
fileName: ${sys:user.home}/AppData/Roaming/MyApplication/MyApplication.log
|
|
||||||
PatternLayout:
|
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
|
||||||
ThresholdFilter:
|
|
||||||
level: info
|
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log
|
fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log
|
||||||
filePattern: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log
|
filePattern: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
@@ -19,6 +12,16 @@ Configuration:
|
|||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
DefaultRolloverStrategy:
|
||||||
|
max: 30
|
||||||
|
Delete:
|
||||||
|
basePath: logs/archive
|
||||||
|
maxDepth: 1
|
||||||
|
IfLastModified:
|
||||||
|
age: 30d
|
||||||
|
IfAccumulatedFileSize:
|
||||||
|
exceeds: 1GB
|
||||||
|
|
||||||
Loggers:
|
Loggers:
|
||||||
Root:
|
Root:
|
||||||
level: info
|
level: info
|
||||||
@@ -4,7 +4,7 @@ Configuration:
|
|||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: logs/application.log
|
fileName: logs/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log
|
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
@@ -12,6 +12,16 @@ Configuration:
|
|||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
DefaultRolloverStrategy:
|
||||||
|
max: 30
|
||||||
|
Delete:
|
||||||
|
basePath: logs/archive
|
||||||
|
maxDepth: 1
|
||||||
|
IfLastModified:
|
||||||
|
age: 30d
|
||||||
|
IfAccumulatedFileSize:
|
||||||
|
exceeds: 1GB
|
||||||
|
|
||||||
Loggers:
|
Loggers:
|
||||||
Root:
|
Root:
|
||||||
level: info
|
level: info
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ class ConfigTest {
|
|||||||
"-c", "2",
|
"-c", "2",
|
||||||
"-t", "4",
|
"-t", "4",
|
||||||
"-i", ".*[abc].*",
|
"-i", ".*[abc].*",
|
||||||
"-fk", "testForced",
|
"--forced-keywords", "testForced",
|
||||||
"-ck", "testCommentary",
|
"--commentary-keywords", "testCommentary",
|
||||||
"-ps", "testPreferred"
|
"--preferred-subtitles", "testPreferred"
|
||||||
};
|
};
|
||||||
CommandLine.populateCommand(Config.getInstance(), sut);
|
CommandLine.populateCommand(Config.getInstance(), sut);
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ class SetConfigParameterTest {
|
|||||||
|
|
||||||
private static Stream<Arguments> provideTestCases() {
|
private static Stream<Arguments> provideTestCases() {
|
||||||
return Stream.of(
|
return Stream.of(
|
||||||
Arguments.of(args("-ck", "test"), 1, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
Arguments.of(args("--commentary-keywords", "test"), 1, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
||||||
Arguments.of(args("-ck", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
Arguments.of(args("--commentary-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
||||||
Arguments.of(args(), 2, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
Arguments.of(args(), 2, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
|
||||||
Arguments.of(args("-fk", "test"), 1, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
Arguments.of(args("--forced-keywords", "test"), 1, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
||||||
Arguments.of(args("-fk", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
Arguments.of(args("--forced-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
||||||
Arguments.of(args(), 3, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
Arguments.of(args(), 3, (Function<Config, Set<String>>) Config::getForcedKeywords),
|
||||||
Arguments.of(args("-ps", "test"), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
|
Arguments.of(args("--preferred-subtitles", "test"), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
|
||||||
Arguments.of(args("-ps", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
|
Arguments.of(args("--preferred-subtitles", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
|
||||||
Arguments.of(args(), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles)
|
Arguments.of(args(), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,9 @@ class SetConfigParameterTest {
|
|||||||
@Test
|
@Test
|
||||||
void validate() {
|
void validate() {
|
||||||
Main sut = new Main();
|
Main sut = new Main();
|
||||||
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-ck")));
|
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--commentary-keywords")));
|
||||||
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-fk")));
|
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--forced-keywords")));
|
||||||
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-e")));
|
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-e")));
|
||||||
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-ps")));
|
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--preferred-subtitles")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<?define JpProductCode="*"?>
|
<?define JpProductCode="*"?>
|
||||||
<?define JpAppName="MKVAudioSubtitleChanger"?>
|
<?define JpAppName="${project.artifactId}"?>
|
||||||
<?define JpAppVersion="4.0.0"?>
|
<?define JpAppVersion="${project.version}"?>
|
||||||
<?define JpAppVendor="RatzzFatzz"?>
|
<?define JpAppVendor="${project.maintainer}"?>
|
||||||
<?define JpProductUpgradeCode="a9527300-d364-4cc3-a392-94035065d8c9"?>
|
<?define JpProductUpgradeCode="a9527300-d364-4cc3-a392-94035065d8c9"?>
|
||||||
<?define JpAppDescription="Change audio and subtitle tracks for .mkv files"?>
|
<?define JpAppDescription="${project.description}"?>
|
||||||
<?define JpHelpURL="github.com/RatzzFatzz"?>
|
<?define JpHelpURL="github.com/${project.maintainer}/${project.artifactId}"?>
|
||||||
|
|
||||||
<Product
|
<Product
|
||||||
Id="$(var.JpProductCode)"
|
Id="$(var.JpProductCode)"
|
||||||
Reference in New Issue
Block a user