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


Java DIDLObject.Class方法代码示例

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


在下文中一共展示了DIDLObject.Class方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendClass

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
protected void appendClass(Document descriptor, Element parent, DIDLObject.Class clazz, String element, boolean appendDerivation) {
    Element classElement = appendNewElementIfNotNull(
            descriptor,
            parent,
            element,
            clazz.getValue(),
            DIDLObject.Property.UPNP.NAMESPACE.URI
    );
    if (clazz.getFriendlyName() != null && clazz.getFriendlyName().length() > 0)
        classElement.setAttribute("name", clazz.getFriendlyName());
    if (appendDerivation)
        classElement.setAttribute("includeDerived", Boolean.toString(clazz.isIncludeDerived()));
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:14,代码来源:DIDLParser.java

示例2: appendClass

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
protected void appendClass(Document descriptor, Element parent,
		DIDLObject.Class clazz, String element, boolean appendDerivation) {
	Element classElement = appendNewElementIfNotNull(descriptor, parent,
			element, clazz.getValue(),
			DIDLObject.Property.UPNP.NAMESPACE.URI);
	if (clazz.getFriendlyName() != null
			&& clazz.getFriendlyName().length() > 0)
		classElement.setAttribute("name", clazz.getFriendlyName());
	if (appendDerivation)
		classElement.setAttribute("includeDerived",
				Boolean.toString(clazz.isIncludeDerived()));
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:13,代码来源:GenerateXml.java

示例3: getContainerIdOf

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
public String getContainerIdOf(DIDLObject.Class clazz) {
    for (DescMeta m : meta) {
        if (clazz.getValue().equals(m.getType())) {
            return m.getId();
        }
    }
    return null;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:9,代码来源:Feature.java

示例4: addAudioContent

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的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

示例5: addImageContent

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
/**
     * 添加图片
     */
    private void addImageContent(Context context, ContentNode rootNode) {

        Container imageContainer = new Container(ContentTree.IMAGE_ID,
                ContentTree.ROOT_ID, "Images", "HPlayer MediaServer",
                new DIDLObject.Class("object.container"), 0);
        imageContainer.setRestricted(true);
        imageContainer.setWriteStatus(WriteStatus.NOT_WRITABLE);

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

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

        while (cursor.moveToNext()) {
            String id = ContentTree.IMAGE_PREFIX
                    + cursor.getInt(cursor.getColumnIndex(MediaStore.Images.Media._ID));
            String title = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Images.Media.TITLE));
            String creator = "unkown";
            String filePath = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
            String mimeType = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE));
            long size = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Images.Media.SIZE));

            Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')),
                    mimeType.substring(mimeType.indexOf('/') + 1)), size,
                    "http://" + address + "/" + id);

            ImageItem imageItem = new ImageItem(id, ContentTree.IMAGE_ID, title, creator, res);
            imageContainer.addItem(imageItem);
            imageContainer.setChildCount(imageContainer.getChildCount() + 1);
            ContentTree.addNode(id, new ContentNode(id, imageItem, filePath));

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

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

示例6: Item

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
public Item(String id, Container parent, String title, String creator, DIDLObject.Class clazz) {
    this(id, parent.getId(), title, creator, false, null, clazz, new ArrayList(), new ArrayList(), new ArrayList());
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:Item.java

示例7: Container

import org.fourthline.cling.support.model.DIDLObject; //导入方法依赖的package包/类
public Container(String id, Container parent, String title, String creator, DIDLObject.Class clazz, Integer childCount) {
    this(id, parent.getId(), title, creator, true, null, clazz, new ArrayList(), new ArrayList(), new ArrayList(), childCount, false, new ArrayList(), new ArrayList(), new ArrayList());
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:Container.java


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