Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lidarr v2 add and lookup artists #126

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix lidarr v2 add + lookup artists commands and update add content me…
…ssages
  • Loading branch information
shayaantx committed Sep 18, 2024
commit 9444bbd956e7a276db046e3e11a35ca45f6993a9
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Made this simple multi chat-client bot to access radarr, sonarr, and lidarr with
- [x] Radarr (v4)
- [x] Sonarr (v4)
- [x] Sonarr (v3)
- [x] Lidarr (v2)
- [x] Lidarr (v1)
- [x] Lidarr (v0)
- [x] ~~Radarr (v3) - no longer supported~~
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/botdarr/api/lidarr/LidarrApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private CommandResponse addArtist(LidarrArtist lidarrArtist) {
LIDARR_CACHE.addArtist(lidarrArtist);
LogManager.getLogger("AuditLog").info("User " + username + " added " + lidarrArtist.getArtistName());
apiRequests.auditRequest(apiRequestType, username, lidarrArtist.getArtistName());
return new SuccessResponse("Artist " + lidarrArtist.getArtistName() + " added, lidarr-detail=" + response.getStatusLine().getReasonPhrase());
return new SuccessResponse("Artist " + lidarrArtist.getArtistName() + " was added successfully!");
}
} catch (IOException e) {
LOGGER.error("Error trying to add artist", e);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/botdarr/api/lidarr/LidarrArtist.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ public String getRemoteImage() {
return lidarrImage.getRemoteUrl();
}
}
for (LidarrImage lidarrImage : this.lastAlbum.getImages()) {
if (lidarrImage.getCoverType().equals("cover") && !Strings.isEmpty(lidarrImage.getUrl())) {
return lidarrImage.getUrl();
if (this.lastAlbum != null) {
for (LidarrImage lidarrImage : this.lastAlbum.getImages()) {
if (lidarrImage.getCoverType().equals("cover") && !Strings.isEmpty(lidarrImage.getUrl())) {
return lidarrImage.getUrl();
}
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/botdarr/api/lidarr/LidarrStatistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public void setPercentOfTracks(Double percentOfTracks) {
this.percentOfTracks = percentOfTracks;
}

private Integer albumCount;
private Integer trackFileCount;
private Integer trackCount;
private Integer totalTrackCount;
private Integer sizeOnDisk;
private Double percentOfTracks;
private Integer albumCount = 0;
private Integer trackFileCount = 0;
private Integer trackCount = 0;
private Integer totalTrackCount = 0;
private Integer sizeOnDisk = 0;
private Double percentOfTracks = 0.0;
}
2 changes: 1 addition & 1 deletion src/main/java/com/botdarr/api/radarr/RadarrApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private CommandResponse addMovie(RadarrMovie radarrMovie) {
RADARR_CACHE.add(radarrMovie);
LogManager.getLogger("AuditLog").info("User " + username + " added " + radarrMovie.getTitle());
apiRequests.auditRequest(apiRequestType, username, radarrMovie.getTitle());
return new SuccessResponse("Movie " + radarrMovie.getTitle() + " added, radarr-detail=" + response.getStatusLine().getReasonPhrase());
return new SuccessResponse("Movie " + radarrMovie.getTitle() + " was added successfully!");
}
} catch (IOException e) {
LOGGER.error("Error trying to add movie", e);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/botdarr/api/sonarr/SonarrApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private CommandResponse addShow(SonarrShow sonarrShow) {
SONARR_CACHE.add(sonarrShow);
LogManager.getLogger("AuditLog").info("User " + username + " added " + title);
apiRequests.auditRequest(apiRequestType, username, title);
return new SuccessResponse("Show " + title + " added, sonarr-detail=" + response.getStatusLine().getReasonPhrase());
return new SuccessResponse("Show " + title + " was added successfully!");
}
} catch (IOException e) {
LOGGER.error("Error trying to add show=" + title, e);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/botdarr/clients/ChatClientBootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ protected <T extends ChatClientResponse> void runAndProcessCommands(String prefi
chatSender.send(clientResponse);
}
}
} catch (Throwable throwable) {
LOGGER.error("Error caught processing command", throwable);
} finally {
CommandContext.end();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.6.14
5.6.15
Loading