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

The following examples show how to use org.fourthline.cling.support.model.WriteStatus. 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: RootUpnpProcessor.java    From airsonic-advanced with GNU General Public License v3.0 6 votes vote down vote up
public Container createRootContainer() {
    StorageFolder root = new StorageFolder();
    root.setId(DispatchingContentDirectory.CONTAINER_ID_ROOT);
    root.setParentID("-1");

    MediaLibraryStatistics statistics = indexManager.getStatistics();
    // returning large storageUsed values doesn't play nicely with
    // some upnp clients
    //root.setStorageUsed(statistics == null ? 0 : statistics.getTotalLengthInBytes());
    root.setStorageUsed(-1L);
    root.setTitle("Airsonic Media");
    root.setRestricted(true);
    root.setSearchable(true);
    root.setWriteStatus(WriteStatus.NOT_WRITABLE);

    root.setChildCount(6);
    return root;
}
 
Example #2
Source File: RootUpnpProcessor.java    From airsonic with GNU General Public License v3.0 6 votes vote down vote up
public Container createRootContainer() {
    StorageFolder root = new StorageFolder();
    root.setId(DispatchingContentDirectory.CONTAINER_ID_ROOT);
    root.setParentID("-1");

    MediaLibraryStatistics statistics = indexManager.getStatistics();
    // returning large storageUsed values doesn't play nicely with
    // some upnp clients
    //root.setStorageUsed(statistics == null ? 0 : statistics.getTotalLengthInBytes());
    root.setStorageUsed(-1L);
    root.setTitle("Airsonic Media");
    root.setRestricted(true);
    root.setSearchable(true);
    root.setWriteStatus(WriteStatus.NOT_WRITABLE);

    root.setChildCount(6);
    return root;
}
 
Example #3
Source File: FolderBasedContentDirectory.java    From subsonic with GNU General Public License v3.0 6 votes vote down vote up
private BrowseResult browseRootMetadata() throws Exception {
    StorageFolder root = new StorageFolder();
    root.setId(CONTAINER_ID_ROOT);
    root.setParentID("-1");

    MediaLibraryStatistics statistics = settingsService.getMediaLibraryStatistics();
    root.setStorageUsed(statistics == null ? 0 : statistics.getTotalLengthInBytes());
    root.setTitle("Subsonic Media");
    root.setRestricted(true);
    root.setSearchable(false);
    root.setWriteStatus(WriteStatus.NOT_WRITABLE);

    List<MusicFolder> musicFolders = settingsService.getAllMusicFolders();
    root.setChildCount(musicFolders.size() + 1);  // +1 for playlists

    DIDLContent didl = new DIDLContent();
    didl.addContainer(root);
    return createBrowseResult(didl, 1, 1);
}
 
Example #4
Source File: Container.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public Container(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata, Integer childCount, boolean searchable, List<Class> createClasses, List<Class> searchClasses, List<Item> items) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
    this.childCount = childCount;
    this.searchable = searchable;
    this.createClasses = createClasses;
    this.searchClasses = searchClasses;
    this.items = items;
}
 
Example #5
Source File: ContentTree.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
protected static ContentNode createRootNode() {
    // create root container
    Container root = new Container();
    root.setId(ROOT_ID);
    root.setParentID("-1");
    root.setTitle("HPlayer MediaServer root directory");
    root.setCreator("HPlayer Media Server");
    root.setRestricted(true);
    root.setSearchable(true);
    root.setWriteStatus(WriteStatus.NOT_WRITABLE);
    root.setChildCount(0);
    ContentNode rootNode = new ContentNode(ROOT_ID, root);
    contentMap.put(ROOT_ID, rootNode);
    return rootNode;
}
 
Example #6
Source File: Container.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public Container(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata, Integer childCount, boolean searchable, List<Class> createClasses, List<Class> searchClasses, List<Item> items) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
    this.childCount = childCount;
    this.searchable = searchable;
    this.createClasses = createClasses;
    this.searchClasses = searchClasses;
    this.items = items;
}
 
Example #7
Source File: ContentTree.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
protected static ContentNode createRootNode() {
	// create root container
	Container root = new Container();
	root.setId(ROOT_ID);
	root.setParentID("-1");
	root.setTitle("GNaP MediaServer root directory");
	root.setCreator("GNaP Media Server");
	root.setRestricted(true);
	root.setSearchable(true);
	root.setWriteStatus(WriteStatus.NOT_WRITABLE);
	root.setChildCount(0);
	ContentNode rootNode = new ContentNode(ROOT_ID, root);
	contentMap.put(ROOT_ID, rootNode);
	return rootNode;
}
 
Example #8
Source File: Item.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Item(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
}
 
Example #9
Source File: Item.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Item(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata, String refID) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
    this.refID = refID;
}
 
Example #10
Source File: Container.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Container(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
}
 
Example #11
Source File: GenerateContentTask.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
/**
     * 添加视频
     */
    private void addVideoContent(Context context, ContentNode rootNode) {

        Container videoContainer = new Container();
        videoContainer.setClazz(new DIDLObject.Class("object.container"));
        videoContainer.setId(ContentTree.VIDEO_ID);
        videoContainer.setParentID(ContentTree.ROOT_ID);
        videoContainer.setTitle("Videos");
        videoContainer.setRestricted(true);
        videoContainer.setWriteStatus(WriteStatus.NOT_WRITABLE);
        videoContainer.setChildCount(0);

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

        Cursor cursor = context.getContentResolver()
                .query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                        null, null, null, null);
        if (cursor == null) {
            return;
        }
        while (cursor.moveToNext()) {
            String id = ContentTree.VIDEO_PREFIX
                    + cursor.getInt(cursor.getColumnIndex(MediaStore.Video.Media._ID));
            String title = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.TITLE));
            String creator = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST));
            String filePath = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
            String mimeType = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE));
            long size = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.SIZE));
            long duration = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.DURATION));
            String resolution = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION));
            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);
            res.setResolution(resolution);

            VideoItem videoItem = new VideoItem(id, ContentTree.VIDEO_ID, title, creator, res);
            videoContainer.addItem(videoItem);
            videoContainer.setChildCount(videoContainer.getChildCount() + 1);
            ContentTree.addNode(id, new ContentNode(id, videoItem, filePath));

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

        cursor.close();
    }
 
Example #12
Source File: GenerateContentTask.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
/**
     * 添加音频
     */
    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();
    }
 
Example #13
Source File: GenerateContentTask.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
/**
     * 添加图片
     */
    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();
    }
 
Example #14
Source File: Item.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Item(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
}
 
Example #15
Source File: Item.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Item(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata, String refID) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
    this.refID = refID;
}
 
Example #16
Source File: Container.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Container(String id, String parentID, String title, String creator, boolean restricted, WriteStatus writeStatus, Class clazz, List<Res> resources, List<Property> properties, List<DescMeta> descMetadata) {
    super(id, parentID, title, creator, restricted, writeStatus, clazz, resources, properties, descMetadata);
}