Cling

Discuss issues related to PS3 Media Server development (only for programmers)

Cling

Postby Raptor399 » Mon May 21, 2012 7:54 am

As you may have noticed, I am trying to improve PMS by integrating Cling.
I created a Raptor399/cling branch, but I'm currently stuck and I need some extra brainpower to move forward.

The server will fire up and when I connect to it with the Cling Workbench I can see the services. I can even browse (still buggy though), e.g.: open "PS3 Media Server > Content Directory > Browse", click "invoke action", set ObjectID = 0, BrowseFlag = "BrowseDirectChildren", StartingIndex = 0, RequestedCount = 100, finally press the "invoke" button. A result is returned and when you examine the result, it is virtually the same as a regular PMS would return.

So the basics appear to work... Except they don't.
Real devices fail to find PMS, or find it but fail to connect (like XBMC).

So... What am I missing? :roll:

And: how can I see Cling debug information from Eclipse (I tried adding "-Djava.util.logging.config.file=${project_loc}/logging.properties" to the VM arguments)?
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: Cling

Postby taconaut » Tue May 22, 2012 11:55 am

Haven't got the time to get into this now. I'd capture a TCP dump using wireshark for the original pms and cling and check what the difference in the returned responses are. Hope you'll be successful with it :)

I always wondered if it was possible to add files anywhere in the DLNA tree rather then adding them to the end of the list as pms does. Did you stumble on anything like that with cling?
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1065
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Cling

Postby lightglitch » Tue May 22, 2012 8:49 pm

Hi develop some stuff for cling and I can help you.

Cling uses java.util.logging you can check http://www.slf4j.org/legacy.html#jul-to-slf4j to integrate those logs in pms

I recommend to use version 2.0 snapshot, has a lot of improvements for dlna.

Here you can see an example on how to use it:

https://github.com/longkerdandy/chii2/t ... erver/upnp
lightglitch a.k.a Mário Franco
lightglitch
Project Member
 
Posts: 113
Joined: Mon Jun 22, 2009 2:58 pm

Re: Cling

Postby lightglitch » Tue May 22, 2012 9:03 pm

taconaut wrote:I always wondered if it was possible to add files anywhere in the DLNA tree rather then adding them to the end of the list as pms does. Did you stumble on anything like that with cling?


You can had then anywhere this doesn't depend on the library, just build the xml with the order of the files that you want.
lightglitch a.k.a Mário Franco
lightglitch
Project Member
 
Posts: 113
Joined: Mon Jun 22, 2009 2:58 pm

Re: Cling

Postby taconaut » Wed May 23, 2012 9:07 am

lightglitch wrote:
taconaut wrote:I always wondered if it was possible to add files anywhere in the DLNA tree rather then adding them to the end of the list as pms does. Did you stumble on anything like that with cling?


You can had then anywhere this doesn't depend on the library, just build the xml with the order of the files that you want.

Thanks for your input! I haven't gone to the DLNA layer of PMS and rather know how the ps3 will refresh the content of its folders when changing the DLNAResources attacheted to a folder. When files or folders have changed when re-entering a folder, all files/folders up from the first one having changed will be removed and the modified list added. On the ps3 it takes a while (seconds up to minutes) to refresh a big list. First the removed files show up as 'parental control' (!?) and the default greyish icon, then they are being removed and finally the new ones added.
I'll probably have to have a look at the DLNA layer to see 1) what pms does and 2) how the ps3 will behave if an XML with a modified list of items is being returned.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1065
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Cling

Postby valib » Sun May 27, 2012 11:35 am

To make it working on real devices the DeviceType in UpnpServer must be "MediaServer".

DeviceType type = new UDADeviceType("MediaServer", 1);

I have tested the code and it is working for containers but implmentation of adding Items raised exception. It means that browsing where are only folders is OK but it does not parse items which are in subfolders.
valib
 
Posts: 6
Joined: Sun May 27, 2012 10:02 am

Re: Cling

Postby Raptor399 » Sun May 27, 2012 4:18 pm

valib wrote:To make it working on real devices the DeviceType in UpnpServer must be "MediaServer".

DeviceType type = new UDADeviceType("MediaServer", 1);

I have tested the code and it is working for containers but implmentation of adding Items raised exception. It means that browsing where are only folders is OK but it does not parse items which are in subfolders.

Ah, great!

That is exactly what I was looking for, thanks! :-)
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: Cling

Postby valib » Sun May 27, 2012 6:29 pm

I have some offers to you.

To show thumbnail of PS3 Media Server at renderers like my TV an bigger icon is needed. I prepared following code.

Code: Select all
public class UpnpServer implements Runnable {

   private static final Logger LOGGER = LoggerFactory.getLogger(UpnpServer.class);

   private static final String ICON_RESOURCE1 = "/resources/images/icon-256.png";
   private static final String ICON_RESOURCE2 = "/resources/images/icon-32.png";
   private static final String ICON_MIMETYPE = "image/png";

,,,,,,

    LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException, URISyntaxException, XmlParseException {

       // Set details like the current PMS configuration
         String deviceType = "urn:schemas-upnp-org:device:MediaServer:1";
         String friendlyName = "PS3 Media Server";
         String manufacturer  = "PMS";
         String manufacturerURL = "http://www.ps3mediaserver.org";
         String modelName = "PMS";
         String modelDescription  = "UPnP/AV 1.0 Compliant Media Server";
         String modelNumber = "01";
         String modelURL = "http://www.ps3mediaserver.org";
        DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier(friendlyName));
        DeviceType type = DeviceType.valueOf(deviceType);
        ModelDetails modelDetails = new ModelDetails(modelName, modelDescription, modelNumber, modelURL);
      ManufacturerDetails manufacturerDetails = new ManufacturerDetails(manufacturer, manufacturerURL);
      DLNADoc dD1 = new DLNADoc("DMS", "1.50");
      DLNADoc dD2 = new DLNADoc("M-DMS", "1.50");
      DLNADoc[] dlnaDocs = new DLNADoc[] {dD1, dD2};
      DeviceDetails details = new DeviceDetails(friendlyName, manufacturerDetails, modelDetails, dlnaDocs, null);
      // Set icons
        Icon icon1 = new Icon(ICON_MIMETYPE, 120, 120, 8, getClass().getResource(ICON_RESOURCE1));
        Icon icon2 = new Icon(ICON_MIMETYPE, 32, 32, 8, getClass().getResource(ICON_RESOURCE2));
        Icon[] icons = new Icon[] {icon1, icon2};
       
        // Bind the ContentDirectory:1 service
        LocalService<ContentDirectory> cdService = new AnnotationLocalServiceBinder().read(ContentDirectory.class);
        cdService.setManager(new DefaultServiceManager(cdService, ContentDirectory.class));

        // Bind the ConnectionManager:1 service
        LocalService<ConnectionManagerService> cmService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
        cmService.setManager(new DefaultServiceManager<ConnectionManagerService>(cmService, ConnectionManagerService.class));

        return new LocalDevice(identity, type, details, icons, new LocalService[] { cdService, cmService });
    }


If you want use it.
Last edited by chocolateboy on Sun May 27, 2012 7:26 pm, edited 1 time in total.
Reason: reformatted
valib
 
Posts: 6
Joined: Sun May 27, 2012 10:02 am

Re: Cling

Postby lightglitch » Sun May 27, 2012 7:21 pm

And to support xbox you need more extra info, that's why I give chii as an example.

Code: Select all
UpnpServiceConfiguration configuration = new DefaultUpnpServiceConfiguration(STREAM_LISTEN_PORT);

Don't need the port, cling will use an automatic given by the system.

And in cling support you have utils for DLNA headers, and Protocol-info.
lightglitch a.k.a Mário Franco
lightglitch
Project Member
 
Posts: 113
Joined: Mon Jun 22, 2009 2:58 pm

Re: Cling

Postby Raptor399 » Sun May 27, 2012 7:31 pm

valib wrote:I have some offers to you.
[...]
If you want use it.


Sure, thanks!
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Next

Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests