Remove bad references to Recommender.

master
Nekojimi 9 months ago
parent 571139a59c
commit ab26e65fdb
  1. 32
      src/main/java/moe/nekojimi/chords/Chords.java
  2. 3
      src/main/java/moe/nekojimi/chords/Downloader.java

@ -56,7 +56,7 @@ public final class Chords extends ListenerAdapter
private final Downloader downloader; private final Downloader downloader;
private final Searcher searcher; private final Searcher searcher;
private final QueueManager queueManager; private final QueueManager queueManager;
private Recommender recommender; // private Recommender recommender;
private JDA jda; private JDA jda;
private final Map<String, Command> commands = new HashMap<>(); private final Map<String, Command> commands = new HashMap<>();
@ -356,15 +356,15 @@ public final class Chords extends ListenerAdapter
public void setRecommenderEnabled(boolean enabled) public void setRecommenderEnabled(boolean enabled)
{ {
if (recommender == null && enabled) // if (recommender == null && enabled)
{ // {
recommender = new Recommender(); //// recommender = new Recommender();
downloader.addSource(recommender); // downloader.addSource(recommender);
} else if (recommender != null && !enabled) // } else if (recommender != null && !enabled)
{ // {
downloader.removeSource(recommender); //// downloader.removeSource(recommender);
recommender = null; // recommender = null;
} // }
} }
public MusicHandler getMusicHandler() public MusicHandler getMusicHandler()
@ -427,10 +427,10 @@ public final class Chords extends ListenerAdapter
return playlists; return playlists;
} }
public Recommender getRecommender() // public Recommender getRecommender()
{ // {
return recommender; // return recommender;
} // }
private class DownloaderMessageHandler implements BiConsumer<TrackRequest, Exception> private class DownloaderMessageHandler implements BiConsumer<TrackRequest, Exception>
{ {
@ -514,8 +514,8 @@ public final class Chords extends ListenerAdapter
else else
jda.getPresence().setActivity(null); jda.getPresence().setActivity(null);
if (recommender != null) // if (recommender != null)
recommender.addSeed(track); // recommender.addSeed(track);
} }
} }

@ -41,6 +41,7 @@ public class Downloader extends QueueThing<TrackRequest, Track>
private static final Pattern FORMAT_PATTERN = Pattern.compile("^([\\w]+)\\s+([\\w]+)\\s+(\\w+ ?\\w*)\\s+(.*)$"); private static final Pattern FORMAT_PATTERN = Pattern.compile("^([\\w]+)\\s+([\\w]+)\\s+(\\w+ ?\\w*)\\s+(.*)$");
public static final Pattern DESTINATION_PATTERN = Pattern.compile("Destination: (.*\\.wav)"); public static final Pattern DESTINATION_PATTERN = Pattern.compile("Destination: (.*\\.wav)");
public static final Pattern PROGRESS_PATTERN = Pattern.compile("\\[download\\].*?([\\d\\.]+)%"); public static final Pattern PROGRESS_PATTERN = Pattern.compile("\\[download\\].*?([\\d\\.]+)%");
private static final Pattern INFO_JSON_PATTERN = Pattern.compile("Writing video metadata as JSON to: (.*\\.info\\.json)");
private static final Pattern ETA_PATTERN = Pattern.compile("\\[download\\].*?ETA\\s+(\\d{1,2}:\\d{2})"); private static final Pattern ETA_PATTERN = Pattern.compile("\\[download\\].*?ETA\\s+(\\d{1,2}:\\d{2})");
private static final Pattern DOWNLOAD_ITEM_PATTERN = Pattern.compile("\\[download\\] Downloading item (\\d+) of (\\d+)"); private static final Pattern DOWNLOAD_ITEM_PATTERN = Pattern.compile("\\[download\\] Downloading item (\\d+) of (\\d+)");
@ -230,7 +231,7 @@ public class Downloader extends QueueThing<TrackRequest, Track>
List<Track> ret = new ArrayList<>(); List<Track> ret = new ArrayList<>();
try try
{ {
String cmd = Chords.getSettings().getYtdlCommand() + " --skip-download --print-json " + request.getUrl().toString(); String cmd = Chords.getSettings().getYtdlCommand() + " --skip-download --write-info-json " + request.getUrl().toString();
Process exec = runCommand(cmd, INFO_TIMEOUT); Process exec = runCommand(cmd, INFO_TIMEOUT);
InputStream input = exec.getInputStream(); InputStream input = exec.getInputStream();

Loading…
Cancel
Save