org.fourthline.cling.support.model.container.MusicAlbum Java Examples

The following examples show how to use org.fourthline.cling.support.model.container.MusicAlbum. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaFileUpnpProcessor.java    From airsonic-advanced with GNU General Public License v3.0 6 votes vote down vote up
public Container createContainer(MediaFile item) {
    MusicAlbum container = new MusicAlbum();
    if (item.isAlbum()) {
        container.setAlbumArtURIs(new URI[] { getDispatcher().getAlbumProcessor().getAlbumArtURI(item.getId())});

        if (item.getArtist() != null) {
            container.setArtists(getDispatcher().getAlbumProcessor().getAlbumArtists(item.getArtist()));
        }
        container.setDescription(item.getComment());
    }
    container.setId(DispatchingContentDirectory.CONTAINER_ID_FOLDER_PREFIX + DispatchingContentDirectory.SEPARATOR + item.getId());
    container.setTitle(item.getName());
    List<MediaFile> children = getChildren(item);
    container.setChildCount(children.size());

    if (! getMediaFileService().isRoot(item)) {
        MediaFile parent = getMediaFileService().getParentOf(item);
        if (parent != null) {
            container.setParentID(String.valueOf(parent.getId()));
        }
    } else {
        container.setParentID(DispatchingContentDirectory.CONTAINER_ID_FOLDER_PREFIX);
    }
    return container;
}
 
Example #2
Source File: AlbumUpnpProcessor.java    From airsonic-advanced with GNU General Public License v3.0 6 votes vote down vote up
public Container createContainer(Album album) {
    MusicAlbum container = new MusicAlbum();

    if (album.getId() == -1) {
        container.setId(getRootId() + DispatchingContentDirectory.SEPARATOR + album.getComment());
    } else {
        container.setId(getRootId() + DispatchingContentDirectory.SEPARATOR + album.getId());
        container.setAlbumArtURIs(new URI[] { getAlbumArtURI(album.getId()) });
        container.setDescription(album.getComment());
    }
    container.setParentID(getRootId());
    container.setTitle(album.getName());
    // TODO: correct artist?
    if (album.getArtist() != null) {
        container.setArtists(getAlbumArtists(album.getArtist()));
    }
    return container;
}
 
Example #3
Source File: FolderBasedContentDirectory.java    From airsonic-advanced with GNU General Public License v3.0 6 votes vote down vote up
private Container createContainer(MediaFile mediaFile) {
    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;
}
 
Example #4
Source File: MediaFileUpnpProcessor.java    From airsonic with GNU General Public License v3.0 6 votes vote down vote up
public Container createContainer(MediaFile item) {
    MusicAlbum container = new MusicAlbum();
    if (item.isAlbum()) {
        container.setAlbumArtURIs(new URI[] { getDispatcher().getAlbumProcessor().getAlbumArtURI(item.getId())});

        if (item.getArtist() != null) {
            container.setArtists(getDispatcher().getAlbumProcessor().getAlbumArtists(item.getArtist()));
        }
        container.setDescription(item.getComment());
    }
    container.setId(DispatchingContentDirectory.CONTAINER_ID_FOLDER_PREFIX + DispatchingContentDirectory.SEPARATOR + item.getId());
    container.setTitle(item.getName());
    List<MediaFile> children = getChildren(item);
    container.setChildCount(children.size());

    if (! getMediaFileService().isRoot(item)) {
        MediaFile parent = getMediaFileService().getParentOf(item);
        if (parent != null) {
            container.setParentID(String.valueOf(parent.getId()));
        }
    } else {
        container.setParentID(DispatchingContentDirectory.CONTAINER_ID_FOLDER_PREFIX);
    }
    return container;
}
 
Example #5
Source File: AlbumUpnpProcessor.java    From airsonic with GNU General Public License v3.0 6 votes vote down vote up
public Container createContainer(Album album) {
    MusicAlbum container = new MusicAlbum();

    if (album.getId() == -1) {
        container.setId(getRootId() + DispatchingContentDirectory.SEPARATOR + album.getComment());
    } else {
        container.setId(getRootId() + DispatchingContentDirectory.SEPARATOR + album.getId());
        container.setAlbumArtURIs(new URI[] { getAlbumArtURI(album.getId()) });
        container.setDescription(album.getComment());
    }
    container.setParentID(getRootId());
    container.setTitle(album.getName());
    // TODO: correct artist?
    if (album.getArtist() != null) {
        container.setArtists(getAlbumArtists(album.getArtist()));
    }
    return container;
}
 
Example #6
Source File: FolderBasedContentDirectory.java    From airsonic with GNU General Public License v3.0 6 votes vote down vote up
private Container createContainer(MediaFile mediaFile) {
    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;
}
 
Example #7
Source File: FolderBasedContentDirectory.java    From subsonic with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: FolderBasedContentDirectory.java    From airsonic-advanced with GNU General Public License v3.0 5 votes vote down vote up
private Container createAlbumContainer(MediaFile album) {
    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;
}
 
Example #9
Source File: FolderBasedContentDirectory.java    From airsonic with GNU General Public License v3.0 5 votes vote down vote up
private Container createAlbumContainer(MediaFile album) {
    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;
}
 
Example #10
Source File: FolderBasedContentDirectory.java    From subsonic with GNU General Public License v3.0 5 votes vote down vote up
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;
}