update jlibloader dependency in maven artifact to 0.3

This commit is contained in:
2016-08-17 20:43:13 +01:00
parent 5f8dc37100
commit 41d6c59940
2 changed files with 30 additions and 11 deletions

View File

@@ -11,14 +11,14 @@ repositories {
}
dependencies {
compile 'com.github.boukefalos:jlibloader:0.2'
compile 'com.github.boukefalos:jlibloader:0.3'
compile 'org.slf4j:slf4j-api:1.7.8'
testCompile 'junit:junit:4.8.2'
}
group = 'com.github.boukefalos'
project.archivesBaseName = 'jlibsox'
version = '0.1'
version = '0.2'
def jniVersion = '14.4.1'
task wrapper(type: Wrapper) {
@@ -122,7 +122,7 @@ mainPom.withXml { provider ->
def dep = deps.appendNode('dependency')
dep.appendNode('groupId', 'com.github.boukefalos')
dep.appendNode('artifactId', 'jlibloader')
dep.appendNode('version', '0.2')
dep.appendNode('version', '0.3')
}
jar {

View File

@@ -1,18 +1,25 @@
package ie.corballis.sox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.boukefalos.jlibloader.Native;
public class Sox {
private static Logger logger = LoggerFactory.getLogger(Sox.class);
private final String soXBinaryPath;
private static String soXBinaryPath;
private String device;
private List<String> arguments = new ArrayList<String>();
@@ -26,10 +33,19 @@ public class Sox {
private boolean hasBeenExecuted = false;
public Sox() {
soXBinaryPath = Native.binary("com.github.boukefalos", "jlibsox", "sox");
}
public Sox(String soxPath) {
this.soXBinaryPath = soxPath;
}
public Sox device(String device) {
this.device = device;
return this;
}
public Sox ignoreLength() {
arguments.add("--ignore-length");
formatOptionSet = true;
@@ -72,7 +88,7 @@ public class Sox {
return this;
}
// global options
// global options
public Sox verbose(Integer level) {
arguments.add("-V" + level.toString());
globalOptionSet = true;
@@ -117,6 +133,9 @@ public class Sox {
arguments.add(0, soXBinaryPath);
logger.debug("Sox arguments: {}", arguments);
ProcessBuilder processBuilder = new ProcessBuilder(arguments);
if (device != null) {
processBuilder.environment().put("AUDIODEV", device);
}
processBuilder.redirectErrorStream(true);
Process process = null;
IOException errorDuringExecution = null;