Skip to content

Commit

Permalink
fix(addShowCommand): remove remaining references of show title on Res…
Browse files Browse the repository at this point in the history
…ponseBuilders
  • Loading branch information
g-nogueira committed Apr 17, 2024
1 parent 68cbbdb commit 023289a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/botdarr/api/sonarr/SonarrCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static List<Command> getCommands(SonarrApi sonarrApi) {
return new ArrayList<Command>() {{
add(new BaseCommand(
"show id add",
"Adds a show using search text and tmdb id (i.e., show id add 484767)",
"Adds a show using tvdb id (i.e., show id add 484767)",
Collections.singletonList("show-tvdbid")) {
@Override
public List<CommandResponse> execute(String command) {
Expand Down Expand Up @@ -83,8 +83,8 @@ public List<CommandResponse> execute(String command) {
}};
}

public static String getAddShowCommandStr(String title, long tvdbId) {
return CommandContext.getConfig().getPrefix() + "show id add " + title + " " + tvdbId;
public static String getAddShowCommandStr(long tvdbId) {
return CommandContext.getConfig().getPrefix() + "show id add " + tvdbId;
}

public static String getHelpShowCommandStr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public String getCommandFromEmbed(MessageEmbed embed) {
return RadarrCommands.getAddMovieCommandStr(embed.getTitle(), Long.parseLong(field.getValue()));
}
if (field.getName().equals(SHOW_LOOKUP_FIELD)) {
return SonarrCommands.getAddShowCommandStr(embed.getTitle(), Long.parseLong(field.getValue()));
return SonarrCommands.getAddShowCommandStr(Long.parseLong(field.getValue()));
}
if (field.getName().equals(ARTIST_LOOKUP_KEY_FIELD)) {
return LidarrCommands.getAddArtistCommandStr(embed.getTitle(), field.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public DiscordResponse build(ShowResponse showResponse) {
SonarrShow show = showResponse.getShow();
embedBuilder.setTitle(show.getTitle());
embedBuilder.addField(SHOW_LOOKUP_FIELD, String.valueOf(show.getTvdbId()), false);
embedBuilder.addField(ADD_SHOW_COMMAND_FIELD_PREFIX, SonarrCommands.getAddShowCommandStr(show.getTitle(), show.getTvdbId()), false);
embedBuilder.addField(ADD_SHOW_COMMAND_FIELD_PREFIX, SonarrCommands.getAddShowCommandStr(show.getTvdbId()), false);
embedBuilder.setImage(show.getRemoteImage());
return new DiscordResponse(embedBuilder.build());
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public DiscordResponse build(NewShowResponse newShowResponse) {
embedBuilder.addField("TvdbId", "" + sonarrShow.getTvdbId(), true);
embedBuilder.setImage(sonarrShow.getRemoteImage());
if (!usingSlashCommand) {
embedBuilder.addField(ADD_SHOW_COMMAND_FIELD_PREFIX, SonarrCommands.getAddShowCommandStr(sonarrShow.getTitle(), sonarrShow.getTvdbId()), false);
embedBuilder.addField(ADD_SHOW_COMMAND_FIELD_PREFIX, SonarrCommands.getAddShowCommandStr(sonarrShow.getTvdbId()), false);
return new DiscordResponse(embedBuilder.build());
}
List<Component> actionComponents = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public MatrixResponse build(ShowResponse showResponse) {
MatrixResponse matrixResponse = new MatrixResponse();
matrixResponse.addContent("<b>Title</b> - " + show.getTitle());
matrixResponse.addContent("<b>TvdbId</b> - " + show.getTvdbId());
matrixResponse.addContent("<b>" + ADD_SHOW_COMMAND_FIELD_PREFIX + "</b> - " + SonarrCommands.getAddShowCommandStr(show.getTitle(), show.getTvdbId()));
matrixResponse.addContent("<b>" + ADD_SHOW_COMMAND_FIELD_PREFIX + "</b> - " + SonarrCommands.getAddShowCommandStr(show.getTvdbId()));
matrixResponse.addImage(show.getRemoteImage());
return matrixResponse;
}
Expand Down Expand Up @@ -223,7 +223,7 @@ public MatrixResponse build(NewShowResponse newShowResponse) {
MatrixResponse matrixResponse = new MatrixResponse();
matrixResponse.addContent("<b>Title</b> - " + sonarrShow.getTitle());
matrixResponse.addContent("<b>TvdbId</b> - " + sonarrShow.getTvdbId());
matrixResponse.addContent("<b>" + ADD_SHOW_COMMAND_FIELD_PREFIX + "</b> - " + SonarrCommands.getAddShowCommandStr(sonarrShow.getTitle(), sonarrShow.getTvdbId()));
matrixResponse.addContent("<b>" + ADD_SHOW_COMMAND_FIELD_PREFIX + "</b> - " + SonarrCommands.getAddShowCommandStr(sonarrShow.getTvdbId()));
matrixResponse.addImage(sonarrShow.getRemoteImage());
return matrixResponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public SlackResponse build(ShowResponse showResponse) {
.text(PlainTextObject.builder().text("TvdbId - " + show.getTvdbId()).build())
.build());
slackResponse.addBlock(SectionBlock.builder()
.text(PlainTextObject.builder().text(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(show.getTitle(), show.getTvdbId())).build())
.text(PlainTextObject.builder().text(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(show.getTvdbId())).build())
.build());
if (!Strings.isBlank(show.getRemoteImage())) {
//if there is no poster to display, slack will fail to render all the blocks
Expand Down Expand Up @@ -348,7 +348,7 @@ public SlackResponse build(NewShowResponse newShowResponse) {
.text(MarkdownTextObject.builder().text("TvdbId - " + sonarrShow.getTvdbId()).build())
.build());
slackResponse.addBlock(SectionBlock.builder()
.text(MarkdownTextObject.builder().text(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(sonarrShow.getTitle(), sonarrShow.getTvdbId())).build())
.text(MarkdownTextObject.builder().text(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(sonarrShow.getTvdbId())).build())
.build());
slackResponse.addBlock(ImageBlock.builder()
.imageUrl(sonarrShow.getRemoteImage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public TelegramResponse build(ShowResponse showResponse) {
List<DomContent> domContents = new ArrayList<>();
domContents.add(b("*Title* - " + show.getTitle()));
domContents.add(code("TvdbId - " + show.getTvdbId()));
domContents.add(u(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(show.getTitle(), show.getTvdbId())));
domContents.add(u(ADD_SHOW_COMMAND_FIELD_PREFIX + " - " + SonarrCommands.getAddShowCommandStr(show.getTvdbId())));
domContents.add(a(show.getRemoteImage()));
return new TelegramResponse(domContents);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ public TelegramResponse build(NewShowResponse newShowResponse) {
domContents.add(b("*Title* - " + sonarrShow.getTitle()));
domContents.add(code("TvdbId - " + sonarrShow.getTvdbId()));
domContents.add(a(sonarrShow.getRemoteImage()));
return getAddResponse(domContents, SonarrCommands.getAddShowCommandStr(sonarrShow.getTitle(), sonarrShow.getTvdbId()));
return getAddResponse(domContents, SonarrCommands.getAddShowCommandStr(sonarrShow.getTvdbId()));
}

@Override
Expand Down

0 comments on commit 023289a

Please sign in to comment.