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;
}
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;
}
Aggregations