diff --git a/src/it/sauronsoftware/jave/FFMPEGExecutor.java b/src/it/sauronsoftware/jave/FFMPEGExecutor.java index 2cfd0f6..db3da1f 100644 --- a/src/it/sauronsoftware/jave/FFMPEGExecutor.java +++ b/src/it/sauronsoftware/jave/FFMPEGExecutor.java @@ -100,11 +100,6 @@ class FFMPEGExecutor { cmd[i + 1] = (String) args.get(i); } -for (int i = 0; i < argsSize+1; i++) { - System.err.print(cmd[i] + " "); -} -System.err.println(); - Runtime runtime = Runtime.getRuntime(); ffmpeg = runtime.exec(cmd); ffmpegKiller = new ProcessKiller(ffmpeg); diff --git a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java index 4740e99..5fb761b 100644 --- a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java +++ b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java @@ -1172,13 +1172,11 @@ public class AudiobookRecorder extends JFrame { int fullLength = 0; Chapter c = o.nextElement(); - + if (c.getChildCount() == 0) continue; String name = c.getName(); File exportFile = new File(export, name + ".wax"); File wavFile = new File(export, name + ".wav"); - File mp3File = new File(export, name + "-untagged.mp3"); - File taggedFile = new File(export, name + ".mp3"); FileOutputStream fos = new FileOutputStream(exportFile); @@ -1205,11 +1203,29 @@ public class AudiobookRecorder extends JFrame { FileInputStream fis = new FileInputStream(exportFile); AudioInputStream ais = new AudioInputStream(fis, format, fullLength); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, wavFile); + fos = new FileOutputStream(wavFile); + AudioSystem.write(ais, AudioFileFormat.Type.WAVE, fos); + fos.flush(); + fos.close(); fis.close(); exportFile.delete(); + } + + + for (Enumeration o = book.children(); o.hasMoreElements();) { + + Chapter c = o.nextElement(); + if (c.getChildCount() == 0) continue; + String name = c.getName(); + + File wavFile = new File(export, name + ".wav"); + File mp3File = new File(export, name + "-untagged.mp3"); + File taggedFile = new File(export, name + ".mp3"); + + System.err.println(attributes); encoder.encode(wavFile, mp3File, attributes); + Mp3File id3 = new Mp3File(mp3File); ID3v2 tags = new ID3v24Tag();