Search in sources :

Example 1 with MusicAlbum

use of org.fourthline.cling.support.model.container.MusicAlbum in project libresonic by Libresonic.

the class FolderBasedContentDirectory method createContainer.

private Container createContainer(MediaFile mediaFile) throws Exception {
    Container container = mediaFile.isAlbum() ? createAlbumContainer(mediaFile) : new MusicAlbum();
    container.setId(CONTAINER_ID_FOLDER_PREFIX + mediaFile.getId());
    container.setTitle(mediaFile.getName());
    List<MediaFile> children = mediaFileService.getChildrenOf(mediaFile, true, true, false);
    container.setChildCount(children.size());
    container.setParentID(CONTAINER_ID_ROOT);
    if (!mediaFileService.isRoot(mediaFile)) {
        MediaFile parent = mediaFileService.getParentOf(mediaFile);
        if (parent != null) {
            container.setParentID(String.valueOf(parent.getId()));
        }
    }
    return container;
}
Also used : Container(org.fourthline.cling.support.model.container.Container) PlaylistContainer(org.fourthline.cling.support.model.container.PlaylistContainer) MusicAlbum(org.fourthline.cling.support.model.container.MusicAlbum)

Example 2 with MusicAlbum

use of org.fourthline.cling.support.model.container.MusicAlbum in project libresonic by Libresonic.

the class FolderBasedContentDirectory method createAlbumContainer.

private Container createAlbumContainer(MediaFile album) throws Exception {
    MusicAlbum container = new MusicAlbum();
    container.setAlbumArtURIs(new URI[] { getAlbumArtUrl(album) });
    // TODO: correct artist?
    if (album.getArtist() != null) {
        container.setArtists(new PersonWithRole[] { new PersonWithRole(album.getArtist()) });
    }
    container.setDescription(album.getComment());
    return container;
}
Also used : MusicAlbum(org.fourthline.cling.support.model.container.MusicAlbum)

Aggregations

MusicAlbum (org.fourthline.cling.support.model.container.MusicAlbum)2 Container (org.fourthline.cling.support.model.container.Container)1 PlaylistContainer (org.fourthline.cling.support.model.container.PlaylistContainer)1