diff --git a/src/main/java/moe/nekojimi/chords/Downloader.java b/src/main/java/moe/nekojimi/chords/Downloader.java index ca8408a..78b8e69 100644 --- a/src/main/java/moe/nekojimi/chords/Downloader.java +++ b/src/main/java/moe/nekojimi/chords/Downloader.java @@ -55,7 +55,7 @@ public class Downloader implements Consumer try { messageHandler.accept(song, null); - String cmd = "/usr/bin/youtube-dl -x --audio-format=wav --no-playlist --write-info-json " + song.getUrl().toString(); + String cmd = "/usr/bin/youtube-dl -x -f=worstaudio/worst --audio-format=wav --no-playlist --write-info-json " + song.getUrl().toString(); System.out.println("Running command: " + cmd); // Process exec = Runtime.getRuntime().exec().split(" ")); Process exec = new ProcessBuilder(cmd.split(" ")).redirectOutput(ProcessBuilder.Redirect.PIPE).start(); @@ -68,7 +68,7 @@ public class Downloader implements Consumer InputStream in = exec.getInputStream(); String output = new String(in.readAllBytes(), Charset.defaultCharset()); System.out.println(output); - Matcher matcher = Pattern.compile("Destination: (.*\\.wav)").matcher(output); + Matcher matcher = Pattern.compile("Destination: (.*)$").matcher(output); if (matcher.find()) song.setLocation(new File(matcher.group(1))); else if (exec.exitValue() != 0)