Read Media Server Content

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Read Media Server Content

fabou3377
Hi,

Thanks for this api.. I'm interessted to use it to read all my content of my MediaServer (Synology)... I have test worbench, where I see it but when I click of contentDirectory -> Use Service, the program stop and exit...
Is there a simple way to get All medias of my synology.

Thanks

Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
This looks like a crashing bug, a stack trace should be printed on your console. Can you please start the workbench with 'java -jar workbench.jar' from the command line, repeat the same steps and post the stack trace here?

If you are on OS X you can just start the workbench with double-clicking on the app, any stacktrace is viewable with the 'Console' application in your Applications/Utilities/ folder.
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
Hi,

here you can see the stacktrace :

===================== The application threw an unhandled exception, exiting... =
=============================
java.lang.NullPointerException
        at org.teleal.cling.support.contentdirectory.ui.ContentBrowseActionCallb
ack$1.isLeaf(ContentBrowseActionCallback.java:81)
        at javax.swing.tree.DefaultTreeModel.isLeaf(DefaultTreeModel.java:185)
        at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimen
sions(BasicTreeUI.java:2712)
        at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayout
Cache.java:475)
        at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePrefer
redSize(VariableHeightLayoutCache.java:1342)
        at javax.swing.tree.VariableHeightLayoutCache.createNodeAt(VariableHeigh
tLayoutCache.java:764)
        at javax.swing.tree.VariableHeightLayoutCache.treeNodesInserted(Variable
HeightLayoutCache.java:473)
        at javax.swing.plaf.basic.BasicTreeUI$Handler.treeNodesInserted(BasicTre
eUI.java:3785)
        at javax.swing.tree.DefaultTreeModel.fireTreeNodesInserted(DefaultTreeMo
del.java:499)
        at javax.swing.tree.DefaultTreeModel.nodesWereInserted(DefaultTreeModel.
java:296)
        at javax.swing.tree.DefaultTreeModel.insertNodeInto(DefaultTreeModel.jav
a:223)
        at org.teleal.cling.support.contentdirectory.ui.ContentBrowseActionCallb
ack.insertChild(ContentBrowseActionCallback.java:147)
        at org.teleal.cling.support.contentdirectory.ui.ContentBrowseActionCallb
ack.updateTreeModel(ContentBrowseActionCallback.java:136)
        at org.teleal.cling.support.contentdirectory.ui.ContentBrowseActionCallb
ack$3.run(ContentBrowseActionCallback.java:108)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

C:\Users\fbourqui.LAMELCOLOR\Downloads\cling-distribution-1.0-beta4\cling-distri
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
In reply to this post by Christian Bauer
There is an another bug. The workbench can see the PS3? PS3 is a renderer, normally we can see on the workbench or not?
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
The PS3 doesn't offer a MediaRenderer service via UPnP. It's only a client: It can access a UPnP MediaServer and play the HTTP streams offered by such a server. My PS3 does not expose any UPnP services at all, it is therefore not discoverable.

I've read that some Sony TVs are offering a MediaRenderer service on the network.
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
Le 11.08.2010 10:45, Christian Bauer [via Cling users and developers] a écrit :
The PS3 doesn't offer a MediaRenderer service via UPnP. It's only a client: It can access a UPnP MediaServer and play the HTTP streams offered by such a server. My PS3 does not expose any UPnP services at all, it is therefore not discoverable.

I've read that some Sony TVs are offering a MediaRenderer service on the network.




Have you a sample code to list the content of a media server?

Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
import org.teleal.cling.UpnpService;
import org.teleal.cling.UpnpServiceImpl;
import org.teleal.cling.model.action.ActionInvocation;
import org.teleal.cling.model.message.header.STAllHeader;
import org.teleal.cling.model.meta.RemoteDevice;
import org.teleal.cling.model.meta.Service;
import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.model.types.UDAServiceType;
import org.teleal.cling.registry.DefaultRegistryListener;
import org.teleal.cling.registry.Registry;
import org.teleal.cling.support.contentdirectory.BrowseActionCallback;
import org.teleal.cling.support.contentdirectory.descriptor.didl.DIDLLite;

public class ContentDirectoryTest {

    public static int counter;

    public static void main(String[] args) throws Exception {

        final UpnpService upnpService = new UpnpServiceImpl();
        upnpService.getRegistry().addListener(
                new DefaultRegistryListener() {
                    public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
                        ServiceType st = new UDAServiceType("ContentDirectory", 1);
                        Service[] services = device.findServices(st);
                        for (Service service : services) {
                            testService(upnpService, service);
                        }
                    }
                }
        );

        upnpService.getControlPoint().search(new STAllHeader()); // Search for all devices and services

        System.out.println("Running tests, please wait...");
        Thread.sleep(10000); // This should be long enough for all devices to reply
        System.out.println("Tests completed!");
        System.exit(0);
    }

    public static void testService(UpnpService upnpService, Service service) {
        DebugCallback callback = new DebugCallback(service, counter);
        System.out.println("[" + counter + "] TESTING: " 
                + service.getDevice().getDisplayString() + " / " 
                + service.getServiceId());
        upnpService.getControlPoint().execute(callback);
        counter++;
    }

    public static class DebugCallback extends BrowseActionCallback {

        int counter;

        public DebugCallback(Service service, int counter) {
            super(service, "0", true, "*", 0, null, "+dc:title");
            this.counter = counter;
        }

        @Override
        public void receivedRaw(ActionInvocation actionInvocation, String xml) {
            System.out.println("[" + counter + "] RECEIVED RAW: " + xml);
        }

        @Override
        public void received(ActionInvocation actionInvocation, DIDLLite didl) {
            System.out.println("[" + counter + "] RECEIVED PARSED CHILDREN: " + didl.getChildren().size());
        }

        @Override
        public void updateStatus(Status status) {
            System.out.println("[" + counter + "] STATUS: " + status.getDefaultMessage());
        }

        @Override
        public void failure(String failureMessage) {
            System.out.println("[" + counter + "] FAILURE: " + failureMessage);

        }
    }

}

This is actually the code I'm using to debug the issue you reported. I'm waiting for a friend who also has a Synlogoy NAS to try this code. If you can run this please post the stdout output here. This is the code that runs just before the crash you observed and the DIDL content is probably violating the specification. I need to see this response from your MediaServer.

Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
I've packaged a binary of this code in runnable form here:

http://teleal.org/tmp/cling-contentdirectorytest.jar

Start it with 'java -jar ...' and post the output, please.
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
Ok, show here the output :

java -jar cling-contentdirectorytest.jar
11 ao¹t 2010 20:20:22 org.teleal.cling.UpnpServiceImpl <init>
INFO: >>> Starting UPnP service...
11 ao¹t 2010 20:20:22 org.teleal.cling.UpnpServiceImpl <init>
INFO: Using configuration: org.teleal.cling.DefaultUpnpServiceConfiguration
11 ao¹t 2010 20:20:22 org.teleal.cling.transport.RouterImpl <init>
INFO: Creating Router: org.teleal.cling.transport.RouterImpl
11 ao¹t 2010 20:20:23 org.teleal.cling.transport.impl.StreamServerImpl init
INFO: Created server (for receiving TCP streams) on: /192.168.10.102:59710
11 ao¹t 2010 20:20:23 org.teleal.cling.transport.impl.MulticastReceiverImpl init

INFO: Creating wildcard socket (for receiving multicast datagrams) on port: 1900

11 ao¹t 2010 20:20:23 org.teleal.cling.transport.impl.MulticastReceiverImpl init

INFO: Joining multicast group: /239.255.255.250:1900 on network interface: Liais
on WiFi Intel(R) 5300 AGN
11 ao¹t 2010 20:20:23 org.teleal.cling.transport.impl.DatagramIOImpl init
INFO: Creating bound socket (for datagram input/output) on: /192.168.10.102
11 ao¹t 2010 20:20:23 org.teleal.cling.UpnpServiceImpl <init>
INFO: <<< UPnP service started successfully
11 ao¹t 2010 20:20:23 org.teleal.cling.protocol.RetrieveRemoteDescriptors descri
be
ATTENTION: Could not hydrate device or its services from descriptor: (RemoteDevi
ce) Identity: (RemoteDeviceIdentity, UDN: uuid:c7671351-ed99-45ee-b435-00507fa68
bf8), Root: true
11 ao¹t 2010 20:20:23 org.teleal.cling.protocol.RetrieveRemoteDescriptors descri
be
ATTENTION: Cause was: org.teleal.cling.binding.xml.DescriptorBindingException: C
ould not parse device descriptor: org.teleal.cling.binding.xml.DescriptorBinding
Exception: Could not parse device DOM: java.lang.RuntimeException: Can't parse s
ervice type string (namespace/type/version): urn:schemas-upnp-org:service: WANDS
LLinkConfig:1
11 ao¹t 2010 20:20:23 org.teleal.cling.protocol.RetrieveRemoteDescriptors descri
be
ATTENTION: Could not hydrate device or its services from descriptor: (RemoteDevi
ce) Identity: (RemoteDeviceIdentity, UDN: uuid:c7671351-ed99-45ee-b435-00507fa68
bf8), Root: true
11 ao¹t 2010 20:20:23 org.teleal.cling.protocol.RetrieveRemoteDescriptors descri
be
ATTENTION: Cause was: org.teleal.cling.binding.xml.DescriptorBindingException: C
ould not parse device descriptor: org.teleal.cling.binding.xml.DescriptorBinding
Exception: Could not parse device DOM: java.lang.RuntimeException: Can't parse s
ervice type string (namespace/type/version): urn:schemas-upnp-org:service: WANDS
LLinkConfig:1
[0] TESTING: Synology Inc DS106e / urn:upnp-org:serviceId:ContentDirectory
[0] STATUS: Loading...
[0] RECEIVED RAW: <DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/
" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:m
etadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/"><container id
="21"  parentID="0"  restricted="1">
<dc:title>Musique</dc:title>
<upnp:class>object.container</upnp:class>
</container>
<container id="48"  parentID="0"  restricted="1">
<dc:title>Photos</dc:title>
<upnp:class>object.container</upnp:class>
</container>
<container id="55"  parentID="0"  restricted="1">
<dc:title>VidÚo</dc:title>
<upnp:class>object.container.storageFolder</upnp:class>
</container>
</DIDL-Lite>
[0] RECEIVED PARSED CHILDREN: 3
[0] STATUS: OK
Tests completed...
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
Thanks for the debug output. I found and probably fixed the problem, could you please try the beta5 snapshot from today:

http://www.teleal.org/projects/download/snapshots/cling/

I've also fixed the problem with the discovery of your other device: "Can't parse service type string (namespace/type/version): urn:schemas-upnp-org:service: WANDSLLinkConfig:1"

This most likely happens because there's a space between "service:" and "WANDSLL..." which is not a valid URN syntax. I've added an exception to the code and it should now discover this device. Please tell me the manufacturer/model so I can mark this in the code.
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
Le 11.08.2010 21:25, Christian Bauer [via Cling users and developers] a écrit :
Thanks for the debug output. I found and probably fixed the problem, could you please try the beta5 snapshot from today:

http://www.teleal.org/projects/download/snapshots/cling/

I've also fixed the problem with the discovery of your other device: "Can't parse service type string (namespace/type/version): urn:schemas-upnp-org:service: WANDSLLinkConfig:1"

This most likely happens because there's a space between "service:" and "WANDSLL..." which is not a valid URN syntax. I've added an exception to the code and it should now discover this device. Please tell me the manufacturer/model so I can mark this in the code.




Thanks but there is no file?
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
Try now, I fixed another problem. My friend can browse his Synology NAS now, so it should work for you as well.

Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
Hi,
thanks for the Job.. It's works.. But there is on thing that maybe I don't understand... When I click to "sent to" and choose the media renderer instance... I can play the music when I invoke the AV transport service in the media renderer... When I do this I have black screen with the music..
Is there the correct procedure to play the music?

There is an other bug. The workbench can detect the standard media render provided by http://opentools.homeip.net/dev-tools-for-upnp...
This tool is the standard upnp sdk provided by intel...

Thanks...
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

fabou3377
In reply to this post by fabou3377
Hi, Christian,

Do you know an hardware device that offer DMR and DMP... There many devices that can DMP but not DMR... I have search on dlna.org but not found...
 Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

Christian Bauer
Administrator
In reply to this post by fabou3377
I've updated the beta5 snapshot. The black screen when playing audio-only with the MediaRenderer was fixed.

I'll look into why the opentools renderer can't be found later.

For any other issues and questions, please open a new thread when necessary.
Reply | Threaded
Open this post in threaded view
|

Re: Read Media Server Content

raman bains
In reply to this post by Christian Bauer