Normalized all file paths

This commit is contained in:
2021-01-22 11:55:38 +00:00
parent b74f1aedb4
commit ead577521d
5 changed files with 18 additions and 12 deletions

2
dist/linux/stub vendored
View File

@@ -5,6 +5,6 @@ java=java
if test -n "$JAVA_HOME"; then if test -n "$JAVA_HOME"; then
java="$JAVA_HOME/bin/java" java="$JAVA_HOME/bin/java"
fi fi
java_args=-Xmx1g java_args=-Xmx8g
exec "$java" $java_args -jar $MYSELF "$@" exec "$java" $java_args -jar $MYSELF "$@"
exit 1 exit 1

View File

@@ -2351,7 +2351,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
book.save(); book.save();
// Add the book to the tree // Add the book to the tree
loadXMLBookStructure(new File(book.getLocation(), "audiobook.abx")); loadXMLBookStructure(book.getLocation("audiobook.abx"));
updateOpenBookList(); updateOpenBookList();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
@@ -3240,8 +3240,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
} }
newSentence.writeAudioData(startSamples); newSentence.writeAudioData(startSamples);
newSentence.setPostGapType("continuation"); newSentence.setPostGapType("sentence");
newSentence.setPostGap(Options.getInteger("catenation.short-sentence")); newSentence.setPostGap(Options.getInteger("catenation.post-sentence"));
selectedSentence.writeAudioData(endSamples); selectedSentence.writeAudioData(endSamples);
selectedSentence.autoTrimSample(); selectedSentence.autoTrimSample();

View File

@@ -502,6 +502,11 @@ public class Book extends BookTreeNode {
return location; return location;
} }
public File getLocation(String dir) {
Debug.trace();
return new File(location, dir);
}
public void setLocation(File l) { public void setLocation(File l) {
Debug.trace(); Debug.trace();
location = l; location = l;

View File

@@ -172,12 +172,7 @@ public class Chapter extends BookTreeNode {
Book book = getBook(); Book book = getBook();
File bookRoot = new File(Options.get("path.storage"), book.getName()); File export = book.getLocation("export");
if (!bookRoot.exists()) {
bookRoot.mkdirs();
}
File export = new File(bookRoot, "export");
if (!export.exists()) { if (!export.exists()) {
export.mkdirs(); export.mkdirs();
} }

View File

@@ -235,6 +235,11 @@ public class Sentence extends BookTreeNode implements Cacheable {
peak = Utils.s2d(Book.getTextNode(root, "peak", "-1.000")); peak = Utils.s2d(Book.getTextNode(root, "peak", "-1.000"));
isDetected = Utils.s2b(Book.getTextNode(root, "detected")); isDetected = Utils.s2b(Book.getTextNode(root, "detected"));
if (sampleSize == 0) {
loadFile();
autoTrimSample();
}
gainPoints = new TreeMap<Integer, Double>(); gainPoints = new TreeMap<Integer, Double>();
Element gp = Book.getNode(root, "gainpoints"); Element gp = Book.getNode(root, "gainpoints");
if (gp != null) { if (gp != null) {
@@ -580,7 +585,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
Debug.d("Get file for", id); Debug.d("Get file for", id);
Book book = getBook(); Book book = getBook();
if (book == null) return null; if (book == null) return null;
File b = new File(book.getLocation(), "files"); File b = book.getLocation("files");
if (!b.exists()) { if (!b.exists()) {
b.mkdirs(); b.mkdirs();
} }
@@ -589,7 +594,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
public File getTempFile() { public File getTempFile() {
Debug.trace(); Debug.trace();
File b = new File(getBook().getLocation(), "files"); File b = getBook().getLocation("files");
if (!b.exists()) { if (!b.exists()) {
b.mkdirs(); b.mkdirs();
} }
@@ -2027,6 +2032,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
public double[] getWaveProfile() { public double[] getWaveProfile() {
if (waveProfile != null) return waveProfile; if (waveProfile != null) return waveProfile;
double[][] samples = getProcessedAudioData(); double[][] samples = getProcessedAudioData();
if (samples[LEFT].length == 0) return null;
waveProfile = new double[samples[LEFT].length]; waveProfile = new double[samples[LEFT].length];
double rt = 0; double rt = 0;