Added Maven step to compile a .jar file with all dependencies (for easy deployment); Added code to define the FFMPEG binary path and video repository through a TOML file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-05-02 16:15:01 -04:00
parent ffb7d2d9f1
commit f861445697
4 changed files with 113 additions and 93 deletions

21
pom.xml
View File

@ -68,6 +68,27 @@
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>tech.bitgoblin.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>

View File

@ -15,8 +15,8 @@ public class App {
// read our config file
Config c = new Config(configFile);
// create new Transcoder object and start the service
//Transcoder t = new Transcoder("~/dragoon");
//t.transcode();
Transcoder t = new Transcoder(c);
t.transcode();
}
}

View File

@ -10,7 +10,7 @@ import tech.bitgoblin.io.IOUtils;
public class Config {
private String configPath;
private final String configPath;
private TomlParseResult result;
public Config(String path) {
@ -18,8 +18,6 @@ public class Config {
// parse config file
try {
this.parseConfig();
String value = this.result.getString("repo");
System.out.println(value);
} catch (IOException e) {
System.out.println("Unable to read config file; please check that " + this.configPath + " is available.");
System.exit(1);
@ -30,6 +28,10 @@ public class Config {
return this.result.getString(key);
}
public boolean contains(String key) {
return this.result.contains(key);
}
private void parseConfig() throws IOException {
// parse config file
Path source = Paths.get(this.configPath);

View File

@ -25,12 +25,9 @@ public class Transcoder {
public Transcoder(Config config) {
this.config = config;
this.repo_dir = IOUtils.resolveTilda(config.getString("transcoder.repo_path"));
this.initDirectory();
if (this.config.contains("transcoder.ffmpeg_path")) {
this.ffmpeg_path = config.getString("transcoder.ffmpeg_path");
}
// define a custom FFMPEG binary path
public Transcoder(String repo_dir, String ffmpeg_path) {
this.repo_dir = IOUtils.resolveTilda(repo_dir);
this.ffmpeg_path = ffmpeg_path;
this.initDirectory();
}