Compare commits

...

2 Commits

Author SHA1 Message Date
Nekojimi 603b7e2cd8 Print user's proper name, not ID. 2021-09-29 20:08:59 +01:00
Nekojimi 3695e4bb13 Downloader: try to get low-quality audio for now. 2021-09-29 20:08:36 +01:00
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

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