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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
ffb7d2d9f1
commit
f861445697
185
pom.xml
185
pom.xml
@ -1,91 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>tech.bitgoblin</groupId>
|
||||
<artifactId>Dragoon</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<groupId>tech.bitgoblin</groupId>
|
||||
<artifactId>Dragoon</artifactId>
|
||||
<version>0.1.0</version>
|
||||
|
||||
<name>Dragoon</name>
|
||||
<url>https://www.bitgoblin.tech</url>
|
||||
<name>Dragoon</name>
|
||||
<url>https://www.bitgoblin.tech</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.tomlj</groupId>
|
||||
<artifactId>tomlj</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.tomlj</groupId>
|
||||
<artifactId>tomlj</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<!-- DO NOT include log4j.properties file in your Jar -->
|
||||
<excludes>
|
||||
<exclude>**/log4j.properties</exclude>
|
||||
</excludes>
|
||||
<archive>
|
||||
<manifest>
|
||||
<!-- Jar file entry point -->
|
||||
<mainClass>tech.bitgoblin.App</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<build>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<!-- DO NOT include log4j.properties file in your Jar -->
|
||||
<excludes>
|
||||
<exclude>**/log4j.properties</exclude>
|
||||
</excludes>
|
||||
<archive>
|
||||
<manifest>
|
||||
<!-- Jar file entry point -->
|
||||
<mainClass>tech.bitgoblin.App</mainClass>
|
||||
</manifest>
|
||||
</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>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
// 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;
|
||||
if (this.config.contains("transcoder.ffmpeg_path")) {
|
||||
this.ffmpeg_path = config.getString("transcoder.ffmpeg_path");
|
||||
}
|
||||
this.initDirectory();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user