use of org.libresonic.player.domain.Artist in project libresonic by Libresonic.
the class RESTController method getArtist.
@RequestMapping(value = "/rest/getArtist", method = { RequestMethod.GET, RequestMethod.POST })
public void getArtist(HttpServletRequest request, HttpServletResponse response) throws Exception {
request = wrapRequest(request);
String username = securityService.getCurrentUsername(request);
int id = getRequiredIntParameter(request, "id");
Artist artist = artistDao.getArtist(id);
if (artist == null) {
error(request, response, ErrorCode.NOT_FOUND, "Artist not found.");
return;
}
List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);
ArtistWithAlbumsID3 result = createJaxbArtist(new ArtistWithAlbumsID3(), artist, username);
for (Album album : albumDao.getAlbumsForArtist(artist.getName(), musicFolders)) {
result.getAlbum().add(createJaxbAlbum(new AlbumID3(), album, username));
}
Response res = createResponse();
res.setArtist(result);
jaxbWriter.writeResponse(request, response, res);
}
Aggregations