org.fourthline.cling.support.model.PersonWithRole Java Examples

The following examples show how to use org.fourthline.cling.support.model.PersonWithRole. 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: FolderBasedContentDirectory.java    From subsonic with GNU General Public License v3.0 6 votes vote down vote up
private Item createItem(MediaFile song) throws Exception {
    MediaFile parent = mediaFileService.getParentOf(song);
    MusicTrack item = new MusicTrack();
    item.setId(String.valueOf(song.getId()));
    item.setParentID(String.valueOf(parent.getId()));
    item.setTitle(song.getTitle());
    item.setAlbum(song.getAlbumName());
    if (song.getArtist() != null) {
        item.setArtists(new PersonWithRole[]{new PersonWithRole(song.getArtist())});
    }
    Integer year = song.getYear();
    if (year != null) {
        item.setDate(year + "-01-01");
    }
    item.setOriginalTrackNumber(song.getTrackNumber());
    if (song.getGenre() != null) {
        item.setGenres(new String[]{song.getGenre()});
    }
    item.setResources(Arrays.asList(createResourceForSong(song)));
    item.setDescription(song.getComment());
    item.addProperty(new DIDLObject.Property.UPNP.ALBUM_ART_URI(getAlbumArtUrl(parent)));

    return item;
}
 
Example #2
Source File: MusicAlbum.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public MusicAlbum setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #3
Source File: PlaylistContainer.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public PlaylistContainer setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #4
Source File: TextItem.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public TextItem setAuthors(PersonWithRole[] persons) {
    removeProperties(UPNP.AUTHOR.class);
    for (PersonWithRole p: persons) {
        addProperty(new UPNP.AUTHOR(p));
    }
    return this;
}
 
Example #5
Source File: MusicVideoClip.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public MusicVideoClip setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #6
Source File: MusicTrack.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public MusicTrack setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #7
Source File: MusicTrack.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public MusicTrack(String id, String parentID, String title, String creator, String album, PersonWithRole artist, Res... resource) {
    super(id, parentID, title, creator, resource);
    setClazz(CLASS);
    if (album != null)
        setAlbum(album);
    if (artist != null)
        addProperty(new UPNP.ARTIST(artist));
}
 
Example #8
Source File: PlaylistItem.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public PlaylistItem setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #9
Source File: VideoItem.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public VideoItem setActors(PersonWithRole[] persons) {
    removeProperties(UPNP.ACTOR.class);
    for (PersonWithRole p : persons) {
        addProperty(new UPNP.ACTOR(p));
    }
    return this;
}
 
Example #10
Source File: MediaResourceDao.java    From BeyondUPnP with Apache License 2.0 5 votes vote down vote up
public static List<Item> getAudioList(String serverUrl, String parentId) {
    List<Item> items = new ArrayList<>();

    //Query all track,add to items
    Cursor c = BeyondApplication.getApplication().getContentResolver()
            .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Audio.Media.TITLE);
    c.moveToFirst();
    while (!c.isAfterLast()) {
        long id = c.getLong(c.getColumnIndex(MediaStore.Audio.Media._ID));
        String title = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
        String creator = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));
        String album = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));

        String data = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
        //Remove SDCard path
        data = data.replaceFirst(storageDir, "");
        //Replace file name by "id.ext"
        String fileName = data.substring(data.lastIndexOf(File.separator));
        String ext = fileName.substring(fileName.lastIndexOf("."));
        data = data.replace(fileName, File.separator + id + ext);

        String mimeType = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE));
        long size = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE));
        long duration = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION));
        //Get duration string
        String durationStr = ModelUtil.toTimeString(duration);

        //Compose audio url
        String url = serverUrl + File.separator + "audio" + File.separator + data;
        Res res = new Res(mimeType, size, durationStr, null, url);

        items.add(new MusicTrack(String.valueOf(id), parentId, title, creator, album, new PersonWithRole(creator), res));

        c.moveToNext();
    }

    return items;
}
 
Example #11
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;
}
 
Example #12
Source File: MusicAlbum.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public MusicAlbum setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #13
Source File: PlaylistContainer.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public PlaylistContainer setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #14
Source File: TextItem.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public TextItem setAuthors(PersonWithRole[] persons) {
    removeProperties(UPNP.AUTHOR.class);
    for (PersonWithRole p: persons) {
        addProperty(new UPNP.AUTHOR(p));
    }
    return this;
}
 
Example #15
Source File: MusicVideoClip.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public MusicVideoClip setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #16
Source File: PlaylistItem.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public PlaylistItem setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #17
Source File: MusicTrack.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public MusicTrack setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
Example #18
Source File: MusicTrack.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public MusicTrack(String id, String parentID, String title, String creator, String album, PersonWithRole artist, Res... resource) {
    super(id, parentID, title, creator, resource);
    setClazz(CLASS);
    if (album != null)
        setAlbum(album);
    if (artist != null)
        addProperty(new UPNP.ARTIST(artist));
}
 
Example #19
Source File: VideoItem.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public VideoItem setActors(PersonWithRole[] persons) {
    removeProperties(UPNP.ACTOR.class);
    for (PersonWithRole p : persons) {
        addProperty(new UPNP.ACTOR(p));
    }
    return this;
}
 
Example #20
Source File: TextItem.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole getFirstAuthor() {
    return getFirstPropertyValue(UPNP.AUTHOR.class);
}
 
Example #21
Source File: MusicTrack.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public MusicTrack(String id, String parentID, String title, String creator, String album, String artist, Res... resource) {
    this(id, parentID, title, creator, album, new PersonWithRole(artist), resource);
}
 
Example #22
Source File: PlaylistItem.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public PersonWithRole[] getArtists() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
Example #23
Source File: MusicTrack.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole getFirstArtist() {
    return getFirstPropertyValue(UPNP.ARTIST.class);
}
 
Example #24
Source File: MusicTrack.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole[] getArtists() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
Example #25
Source File: PlaylistItem.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public PersonWithRole getFirstArtist() {
    return getFirstPropertyValue(UPNP.ARTIST.class);
}
 
Example #26
Source File: MusicVideoClip.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole getFirstArtist() {
    return getFirstPropertyValue(UPNP.ARTIST.class);
}
 
Example #27
Source File: MusicVideoClip.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole[] getArtists() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
Example #28
Source File: PlaylistItem.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole[] getArtists() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
Example #29
Source File: TextItem.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public PersonWithRole[] getAuthors() {
    List<PersonWithRole> list = getPropertyValues(UPNP.AUTHOR.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
Example #30
Source File: VideoItem.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public PersonWithRole[] getActors() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ACTOR.class);
    return list.toArray(new PersonWithRole[list.size()]);
}