Compare commits

..

No commits in common. "603b7e2cd8d6432e25c55d1d305a24a9a570c63d" and "c8810ca271273564663dbb8738dfdcc0202c0fa0" have entirely different histories.

2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ public class Downloader implements Consumer<Song>
try try
{ {
messageHandler.accept(song, null); messageHandler.accept(song, null);
String cmd = "/usr/bin/youtube-dl -x -f=worstaudio/worst --audio-format=wav --no-playlist --write-info-json " + song.getUrl().toString(); String cmd = "/usr/bin/youtube-dl -x --audio-format=wav --no-playlist --write-info-json " + song.getUrl().toString();
System.out.println("Running command: " + cmd); System.out.println("Running command: " + cmd);
// Process exec = Runtime.getRuntime().exec().split(" ")); // Process exec = Runtime.getRuntime().exec().split(" "));
Process exec = new ProcessBuilder(cmd.split(" ")).redirectOutput(ProcessBuilder.Redirect.PIPE).start(); 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(); InputStream in = exec.getInputStream();
String output = new String(in.readAllBytes(), Charset.defaultCharset()); String output = new String(in.readAllBytes(), Charset.defaultCharset());
System.out.println(output); System.out.println(output);
Matcher matcher = Pattern.compile("Destination: (.*)$").matcher(output); Matcher matcher = Pattern.compile("Destination: (.*\\.wav)").matcher(output);
if (matcher.find()) if (matcher.find())
song.setLocation(new File(matcher.group(1))); song.setLocation(new File(matcher.group(1)));
else if (exec.exitValue() != 0) else if (exec.exitValue() != 0)

View File

@ -185,7 +185,7 @@ public class Main extends ListenerAdapter
try try
{ {
Song song = new Song(new URL(arg)); Song song = new Song(new URL(arg));
song.setRequestedBy(event.getAuthor().getName()); song.setRequestedBy(event.getAuthor().getId());
song.setRequestedIn(event.getChannel().getId()); song.setRequestedIn(event.getChannel().getId());
// event.getChannel().sendMessage("Downloading ...").queue(); // event.getChannel().sendMessage("Downloading ...").queue();
downloader.accept(song); downloader.accept(song);