UUID usage in DLNA

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

UUID usage in DLNA

Postby taconaut » Thu Sep 15, 2011 4:55 pm

Issue 1211 is related to the way the UUID is being generated by pms (see issue for details). Is there a benefit of always using the same UUID as opposed to generate a random one? The UUID generated based on the MAC address will probably indeed be unique, the one generated based on the name of the NIC is obviously not necessarily.

Code: Select all
if (!uuidBasedOnMAC) {
   if (ni != null && (ni.getDisplayName() != null || ni.getName() != null)) {
      uuid = UUID.nameUUIDFromBytes((ni.getDisplayName() != null ? ni.getDisplayName() : (ni.getName() != null ? ni.getName() : "dummy")).getBytes()).toString(); //$NON-NLS-1$
   } else {
      uuid = UUID.randomUUID().toString();
   }
}

What's the benefit of the first if clause and why wouldn't we always generate a random one in this case? Looking for someone more knowledgable with DLNA then me :)
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: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: UUID usage in DLNA

Postby renszarv » Thu Sep 15, 2011 11:59 pm

I think, having a persistent UID is good, because it seems that the clients remembers at least the names. So If we use totally random UID-s, after a couple of restarts, the average client will see a lots of 'PS3 Media server[xyz]" record in it's net view :) I think the correct solution would be generate a random UID, and store it in the config, and after that re-use it every time.
renszarv
Project Member
 
Posts: 105
Joined: Sun Aug 21, 2011 7:37 pm

Re: UUID usage in DLNA

Postby taconaut » Fri Sep 16, 2011 7:19 am

Thanks, I won't change anything in there for now, as the mechanism would need to be able to detect a uuid not being unique on the network and regenerate one. Don't think It's worth the hassle for this single case
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: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: UUID usage in DLNA

Postby SharkHunter » Fri Sep 16, 2011 8:59 am

I think this would be nice to do. Generate a UUID like today and stash in the PMS.conf. This allows you to remove the genrated (to regenerate) or modify it yourself. Now my Bravia thinks there are 10 PMS (all on the same host) but only one is reachable, hard to find out which since they are all called PMS [Host] :)
SharkHunter
 
Posts: 941
Joined: Tue Jun 01, 2010 8:39 pm

Re: UUID usage in DLNA

Postby taconaut » Fri Sep 16, 2011 12:29 pm

Ok, then it's not a single request anymore :)

I'd propose this:
  • Use uuid configured in PMS.config
  • If above failed, generate uuid based on MAC (and store it)
  • If above failed, generate a random uuid (and store it)
If we keep the generation by name or display name of the NIC as it is now, the same uuid will still be generated every time as described in the issue and will have to be changed manually in the config.
Do we need a button 'Regenerate UUID' (forcing a random generation) in the GUI? It will confuse more people then it will help probably!?
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: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: UUID usage in DLNA

Postby renszarv » Fri Sep 16, 2011 10:59 pm

taconaut wrote:Ok, then it's not a single request anymore :)

I'd propose this:
  • Use uuid configured in PMS.config
  • If above failed, generate uuid based on MAC (and store it)
  • If above failed, generate a random uuid (and store it)
If we keep the generation by name or display name of the NIC as it is now, the same uuid will still be generated every time as described in the issue and will have to be changed manually in the config.
Do we need a button 'Regenerate UUID' (forcing a random generation) in the GUI? It will confuse more people then it will help probably!?


I think, you should add a text field where the user can edit that value, additionally to the 'random UUID' button, but it should be hidden in some very 'Advanced Settings' panel :)
renszarv
Project Member
 
Posts: 105
Joined: Sun Aug 21, 2011 7:37 pm

Re: UUID usage in DLNA

Postby Raptor399 » Tue Sep 20, 2011 9:40 pm

taconaut wrote:The UUID generated based on the MAC address will probably indeed be unique

Then I'd simply go for that and skip all the configurability.
No need to overengineer something that barely ever causes problems.
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: UUID usage in DLNA

Postby taconaut » Wed Sep 21, 2011 7:24 am

Raptor399 wrote:Then I'd simply go for that and skip all the configurability.

That's what's being done by default. For this issue the MAC address retrieval failed for whatever reason and the fall back was to generate it by the adapter name which resulteted in the same uuid for both machines, as they used the same adapter.
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: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: UUID usage in DLNA

Postby Raptor399 » Wed Sep 21, 2011 10:35 am

Ah, I missed the discussion at the issue itself and didn't realize that in this case no MAC address could be established.

I still would opt for something that is bound to be unique and constant per PC, like ultimately throw the system name in the mix or something. It looks like the original solution attempts that.

But looking at the issue, it strikes me as very odd that the interface does not reveal any data about itself. No MAC address and no hardware address? How is it communicating to the outside world without those?
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: UUID usage in DLNA

Postby taconaut » Wed Sep 21, 2011 1:47 pm

@Raptor
No idea why the MAC resolution fails, but it seems shagrath had encountered this as well, as he implemented fail safes

If there's no opposition, I'll change the code to behave as proposed. The uuid will always be the same between application restarts.
  • Use uuid configured in PMS.config
  • If above failed, generate uuid based on MAC (and store it)
  • If above failed, generate a random uuid (and store it)

As only advanced users will notice the problem being related to a duplicate uuid on the network, they will be able to delete or edit it in pms.conf to have a unique one. I'll leave the GUI alone.
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: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Next

Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests