Downloader: try to get low-quality audio for now.
This commit is contained in:
parent
c8810ca271
commit
3695e4bb13
|
@ -55,7 +55,7 @@ public class Downloader implements Consumer<Song>
|
|||
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<Song>
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue