|
|
|
@ -35,7 +35,7 @@ public class PlayCommand extends Command |
|
|
|
|
private static final double SEARCH_SCORE_THRESHOLD_DISPLAY = 0.6; |
|
|
|
|
private static final double SEARCH_SCORE_THRESHOLD_AUTOPLAY = 9999; // disable autoplay it sucks
|
|
|
|
|
|
|
|
|
|
// private List<Result> lastSearchResults;
|
|
|
|
|
private List<Result> lastSearchResults; |
|
|
|
|
|
|
|
|
|
public PlayCommand(Chords main) |
|
|
|
|
{ |
|
|
|
@ -56,15 +56,15 @@ public class PlayCommand extends Command |
|
|
|
|
} catch (MalformedURLException mux) |
|
|
|
|
{ |
|
|
|
|
// not a URL, try parsing it as a search result
|
|
|
|
|
if (request.getSearchResults() != null && !request.getSearchResults().isEmpty()) |
|
|
|
|
if (lastSearchResults != null && !lastSearchResults.isEmpty()) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
int index = Integer.parseInt(invocation.getArgs().get(0)); |
|
|
|
|
int size = request.getSearchResults().size(); |
|
|
|
|
int size = lastSearchResults.size(); |
|
|
|
|
if (index >= 1 && index <= size) |
|
|
|
|
{ |
|
|
|
|
Result result = request.getSearchResults().get(index - 1); |
|
|
|
|
Result result = lastSearchResults.get(index - 1); |
|
|
|
|
request.setResult(result); |
|
|
|
|
bot.queueDownload(request); |
|
|
|
|
// event.getChannel().sendMessage("Track removed.").queue();
|
|
|
|
@ -91,8 +91,7 @@ public class PlayCommand extends Command |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
request.setSearchResults(results); |
|
|
|
|
// lastSearchResults = results;
|
|
|
|
|
lastSearchResults = results; |
|
|
|
|
|
|
|
|
|
if (results.isEmpty()) |
|
|
|
|
{ |
|
|
|
@ -130,4 +129,9 @@ public class PlayCommand extends Command |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String argumentDescription() |
|
|
|
|
{ |
|
|
|
|
return "<URL / Search>"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|