Search in sources :

Example 11 with Artist

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);
}
Also used : Artist(org.libresonic.player.domain.Artist) HttpServletResponse(javax.servlet.http.HttpServletResponse) MusicFolder(org.libresonic.player.domain.MusicFolder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Artist (org.libresonic.player.domain.Artist)11 HttpServletResponse (javax.servlet.http.HttpServletResponse)7 MusicFolder (org.libresonic.player.domain.MusicFolder)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConsoleReporter (com.codahale.metrics.ConsoleReporter)1 Timer (com.codahale.metrics.Timer)1 Test (org.junit.Test)1 Album (org.libresonic.player.domain.Album)1 Bookmark (org.libresonic.player.domain.Bookmark)1 MediaFile (org.libresonic.player.domain.MediaFile)1 SearchResult (org.libresonic.player.domain.SearchResult)1 org.libresonic.restapi (org.libresonic.restapi)1