当前位置: 首页>>代码示例>>Java>>正文


Java PersonWithRole类代码示例

本文整理汇总了Java中org.fourthline.cling.support.model.PersonWithRole的典型用法代码示例。如果您正苦于以下问题:Java PersonWithRole类的具体用法?Java PersonWithRole怎么用?Java PersonWithRole使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PersonWithRole类属于org.fourthline.cling.support.model包,在下文中一共展示了PersonWithRole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createItem

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
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;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:25,代码来源:FolderBasedContentDirectory.java

示例2: createAlbumContainer

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
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;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:13,代码来源:FolderBasedContentDirectory.java

示例3: getAudioList

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
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;
}
 
开发者ID:kevinshine,项目名称:BeyondUPnP,代码行数:39,代码来源:MediaResourceDao.java

示例4: setActors

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public VideoItem setActors(PersonWithRole[] persons) {
    removeProperties(UPNP.ACTOR.class);
    for (PersonWithRole p : persons) {
        addProperty(new UPNP.ACTOR(p));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:VideoItem.java

示例5: setArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public PlaylistItem setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:PlaylistItem.java

示例6: MusicTrack

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
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));
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:9,代码来源:MusicTrack.java

示例7: setArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public MusicTrack setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:MusicTrack.java

示例8: setArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public MusicVideoClip setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:MusicVideoClip.java

示例9: setAuthors

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public TextItem setAuthors(PersonWithRole[] persons) {
    removeProperties(UPNP.AUTHOR.class);
    for (PersonWithRole p: persons) {
        addProperty(new UPNP.AUTHOR(p));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:TextItem.java

示例10: setArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public PlaylistContainer setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:PlaylistContainer.java

示例11: setArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public MusicAlbum setArtists(PersonWithRole[] artists) {
    removeProperties(UPNP.ARTIST.class);
    for (PersonWithRole artist : artists) {
        addProperty(new UPNP.ARTIST(artist));
    }
    return this;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:MusicAlbum.java

示例12: getAlbumArtists

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public PersonWithRole[] getAlbumArtists(String artist) {
    return new PersonWithRole[] { new PersonWithRole(artist) };
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:4,代码来源:AlbumUpnpProcessor.java

示例13: addAudioContent

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
/**
     * 添加音频
     */
    private void addAudioContent(Context context, ContentNode rootNode) {

        Container audioContainer = new Container(ContentTree.AUDIO_ID,
                ContentTree.ROOT_ID, "Audios", "HPlayer MediaServer",
                new DIDLObject.Class("object.container"), 0);
        audioContainer.setRestricted(true);
        audioContainer.setWriteStatus(WriteStatus.NOT_WRITABLE);

        rootNode.getContainer().addContainer(audioContainer);
        rootNode.getContainer().setChildCount(
                rootNode.getContainer().getChildCount() + 1);
        ContentTree.addNode(ContentTree.AUDIO_ID, new ContentNode(
                ContentTree.AUDIO_ID, audioContainer));

        Cursor cursor = context.getContentResolver()
                .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                        null, null, null, null);
        if (cursor == null) {
            return;
        }

        while (cursor.moveToNext()) {
            String id = ContentTree.AUDIO_PREFIX
                    + cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media._ID));
            String title = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
            String creator = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));
            String filePath = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
            String mimeType = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE));
            long size = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE));
            long duration = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION));
            String album = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));
            Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')),
                    mimeType.substring(mimeType.indexOf('/') + 1)), size,
                    "http://" + address + "/" + id);
            res.setDuration(duration / (1000 * 60 * 60) + ":"
                    + (duration % (1000 * 60 * 60)) / (1000 * 60) + ":"
                    + (duration % (1000 * 60)) / 1000);

            // Music Track must have `artist' with role field, or
            // DIDLParser().generate(didl) will throw nullpointException
            MusicTrack musicTrack = new MusicTrack(id,
                    ContentTree.AUDIO_ID, title, creator, album,
                    new PersonWithRole(creator, "Performer"), res);
            audioContainer.addItem(musicTrack);
            audioContainer.setChildCount(audioContainer.getChildCount() + 1);
            ContentTree.addNode(id, new ContentNode(id, musicTrack, filePath));

//            Log.d(TAG, "added audio item " + title + "from " + filePath);
        }

        cursor.close();
    }
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:63,代码来源:GenerateContentTask.java

示例14: getFirstActor

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public PersonWithRole getFirstActor() {
    return getFirstPropertyValue(UPNP.ACTOR.class);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:VideoItem.java

示例15: getActors

import org.fourthline.cling.support.model.PersonWithRole; //导入依赖的package包/类
public PersonWithRole[] getActors() {
    List<PersonWithRole> list = getPropertyValues(UPNP.ACTOR.class);
    return list.toArray(new PersonWithRole[list.size()]);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:5,代码来源:VideoItem.java


注:本文中的org.fourthline.cling.support.model.PersonWithRole类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。