4 Commits

Author SHA1 Message Date
1da375267a Version bump to v0.3.13
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-02-27 01:11:20 -05:00
d7a4513de7 Updating README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-02-27 01:09:45 -05:00
37f2bf0268 [Issue #13] - adding install parameter to install a new config file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-02-27 01:02:53 -05:00
5f8df35171 Added -h option to display available CLI options to user
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-02-27 00:37:00 -05:00
4 changed files with 103 additions and 28 deletions

View File

@ -26,6 +26,34 @@ Then install dragoon! Use the command below if you DON'T want DNF to install a b
dnf --setopt=install_weak_deps=False --best install dragoon
```
## Configuration
If you were paying attention to Dragoon's output, you would have noticed that it failed with a complaint about not finding a configuration file. The location might move in the future or even be configurable, but for now you need to have a TOML file located at `~/.config/dragoon.toml` with at minimum the following contents:
```toml
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
[transcoder]
repo_path = '~/videos' # location of the videos to transcode
interval = 15 # number of minutes in between transcoding runs
video_format = 'mov' # video container format
video_codec = 'dnxhd' # video codec to use
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
video_profile = 'dnxhr_hq' # DNxHD has multiple presets for various video qualities
audio_codec = 'pcm_s16le' # audio codec to use
```
You can also run `./dragoon.jar -i` to install a new configuration file with some "workable" defaults. You can pair this with the `-c /path/to/config.toml` flag to specify a location to put the config file.
## CLI Parameters
Dragoon's CLI features some flags to help you get moving:
`-h` - prints the help message.
`-c /path/to/config.toml` - specify a path to a configuration file.
`-i` - install a new configuration file.
## Building
Currently this project is targeting Java 17 LTS and uses Maven to manage the software lifecycle. Thus, you must have a Java 17 JDK and Maven installed to build this project.
@ -47,18 +75,3 @@ Now that the needed tools are installed, you should be able to build this projec
Then you can run the transcoder:
`java -jar target/Dragon-VERSION-jar-with-dependencies.jar`
## Configuration
If you were paying attention to Dragoon's output, you would have noticed that it failed with a complaint about not finding a configuration file. The location might move in the future or even be configurable, but for now you need to have a TOML file located at `~/.config/dragoon.toml` with at minimum the following contents:
```toml
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
[transcoder]
repo_path = '~/videos' # location of the videos to transcode
video_format = 'mov' # video container format
video_codec = 'dnxhd' # video codec to use
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
video_profile = 'dnxhr_hq' # DNxHD has multiple presets for various video qualities
audio_codec = 'pcm_s16le' # audio codec to use
```

View File

@ -6,7 +6,7 @@
<groupId>tech.bitgoblin</groupId>
<artifactId>dragoon</artifactId>
<version>0.3.12</version>
<version>0.3.13</version>
<name>Dragoon</name>
<url>https://www.bitgoblin.tech</url>
@ -182,7 +182,7 @@
<packager>Bit Goblin</packager>
<prefix>/opt</prefix>
<changelogFile>${project.basedir}/src/build/changelog.txt</changelogFile>
<targetOs>linux</targetOs>
<targetOs>${os.name}</targetOs>
<mappings>
<mapping>
<directory>/opt/dragoon</directory>

View File

@ -1,28 +1,80 @@
package tech.bitgoblin.config;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import org.apache.commons.cli.*;
import tech.bitgoblin.Logger;
import tech.bitgoblin.io.IOUtils;
public class Cmd {
private String helpHeader = "Start the Dragoon video transcoder.";
private String helpFooter = "Report issues at https://git.metaunix.net/BitGoblin/dragoon/issues/";
private String configPath = "~/.config/dragoon.toml";
public Cmd(String[] args) throws ParseException {
Options options = new Options();
Option configPath = new Option("c", "configPath", true, "configuration file path (defaults to /etc/dragoon/config.toml)");
// print help for the user
Option helpOption = new Option("h", "help", false, "Display CLI usage and options.");
options.addOption(helpOption);
// install a config file in the user's home directory
Option installOption = new Option("i", "install", false, "Install configuration file in the user's home directory (or specify a location with -c).");
options.addOption(installOption);
// allow the user to specify a config file manually
Option configPath = new Option("c", "configPath", true, "Configuration file path (defaults to " + this.configPath + ")");
configPath.setRequired(false);
options.addOption(configPath);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = parser.parse(options, args);
// check if the help option was called
if (cmd.hasOption("help")) {
this.printHelp(options);
}
// check if the install option was called
if (cmd.hasOption("install")) {
try {
this.installConfig();
} catch (IOException e) {
e.printStackTrace();
Logger.logger.error("Unable to install new configuration file; please refer to the stack trace above to resolve the error.");
System.exit(2);
}
}
// set the configPath variable if the option was passed to the program
if (cmd.hasOption("configPath")) {
this.configPath = cmd.getOptionValue("configPath");
}
}
public void printHelp(Options options) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("Dragoon", this.helpHeader, options, this.helpFooter, true);
System.exit(0);
}
public void installConfig() throws IOException {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
InputStream is = classloader.getResourceAsStream("example.config");
Files.copy(is, Paths.get(IOUtils.resolveTilda(this.configPath)), StandardCopyOption.REPLACE_EXISTING);
Logger.logger.info("A new configuration file has been installed at " + this.configPath + ".");
System.exit(0);
}
public String getConfigPath() {
return this.configPath;
}

View File

@ -0,0 +1,10 @@
[transcoder]
repo_path = '~/dragoon'
interval = 15
video_format = 'mov'
video_codec = 'dnxhd'
video_profile = 'dnxhr_hq'
video_resolution = '1920x1080'
video_framerate = '60'
video_color = 'yuv422p'
audio_codec = 'pcm_s16le'