Sorted languages available instead of just getting the list
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
2f3ebf0509
commit
5d96a15113
@ -126,7 +126,7 @@ public abstract class Command {
|
|||||||
private void handleOk(String arg, EmbedCreateSpec embed, boolean isId, Movie movie, ListResponse<SubtitleInfo> subtitles) {
|
private void handleOk(String arg, EmbedCreateSpec embed, boolean isId, Movie movie, ListResponse<SubtitleInfo> subtitles) {
|
||||||
embed.setColor(Color.MEDIUM_SEA_GREEN);
|
embed.setColor(Color.MEDIUM_SEA_GREEN);
|
||||||
Stream<String> subtitlesStream = getSubtitleStream(subtitles.getData())
|
Stream<String> subtitlesStream = getSubtitleStream(subtitles.getData())
|
||||||
.map(subtitleInfo -> subtitleInfo.getSubtitleFileId() + " - " + subtitleInfo.getLanguage());
|
.map(SubtitleInfo::getLanguage).sorted();
|
||||||
String formattedSubtitles = subtitlesStream.limit(20).collect(Collectors.joining("\n"));
|
String formattedSubtitles = subtitlesStream.limit(20).collect(Collectors.joining("\n"));
|
||||||
embed.setDescription("You requested a list of the languages available for a movie with the " +
|
embed.setDescription("You requested a list of the languages available for a movie with the " +
|
||||||
(isId ? "IMDB Identifier" : "title") + " '" + arg + "'. ");
|
(isId ? "IMDB Identifier" : "title") + " '" + arg + "'. ");
|
||||||
|
@ -39,7 +39,7 @@ public class ListLangMovie extends Command {
|
|||||||
else throw new UnauthorizedException("");
|
else throw new UnauthorizedException("");
|
||||||
} catch (UnauthorizedException e) {
|
} catch (UnauthorizedException e) {
|
||||||
logger.error("Not logged in on OpenSubtitles! {}", e.getMessage());
|
logger.error("Not logged in on OpenSubtitles! {}", e.getMessage());
|
||||||
logger.warn("It may be due to a website being down. If it's not" +
|
logger.warn("It may be due to a website being down. If it's not " +
|
||||||
"the case, please fix this issue quickly.");
|
"the case, please fix this issue quickly.");
|
||||||
embed.setDescription("I cannot search for subtitle languages right now. Sorry.");
|
embed.setDescription("I cannot search for subtitle languages right now. Sorry.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user