Notices


Reply
Thread Tools
Posts: 162 | Thanked: 351 times | Joined on Apr 2006 @ Cotswolds, UK
#1
I created a small hack to allow the Media Player to see a DLNA Media Server which is the other side of a router which does not forward multicast messages. This is not a DLNA Remote Access implementation, and it doesn't handle NAT, firewalls, etc. It is just for cases where you have IP connectivity between the N900 and the media server but the multicast messages can't get through.

The hack is a python script which you run on your N900 (it runs on MeeGo as well). By default it only advertises the server to the local device although there is an option to advertise to the whole network (the part the multicasts can reach, anyway).

To install it, get the .zip file attached to this post, unzip it and you will find a file called ssdp-fake.py. Copy that to your home directory on the N900, open an Xterm and run it as "./ssdp-fake.py <server>", where <server> is the IP address or hostname of your media server.

I created this for my own use and I have only ever tested it with my server which is running MiniDLNA. If it doesn't work for you, sorry! Some people may still find it useful as a base to create a better program.

Be aware that the script does NOT follow the DLNA rules for the messages. It is a quick hack. In particular, I do not recommend running more than one copy (for example to announce more than one server) each using the "-a" option as they will end up syncing their announcements (I should be randomising the delays but I am not).

[This is also my first python program so I apologise for the horrible coding styles]
Attached Files
File Type: zip ssdp-fake.zip (2.0 KB, 367 views)
 

The Following 7 Users Say Thank You to Graham Cobb For This Useful Post:
Posts: 7 | Thanked: 2 times | Joined on Sep 2010
#2
Hi!

Media player on my N900 does not list my Media Server. Tried the hack but got an error
"/bin/sh: ssdp-fake.py: not found"

Please advise

Thanks
Lakshman
 
Posts: 87 | Thanked: 56 times | Joined on Nov 2008
#3
Thank you very much, this was the missing piece to get DLNA to tunnel to N900 through ssh VPN tunnel.

There is small nuisance still: I don't get the standard Media player to recognize my DLNA server through tunnel. Mediabox and Zhaan are working.

Does anybody use this "fake" advertisement with standard Media player?

I create VPN tunnel with (inefficient...) ssh vpn with following commands

ssh -f -w 0:2 myhost "(sleep 1; ifconfig tun2 192.168.0.99 pointopoint 192.168.0.30 ; arp -sD 192.168.0.30 eth0 pub )"
ifconfig tun0 192.168.0.30 pointopoint 192.168.0.99
route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.30 tun0
route add myhost dev gprs0
route add default gw 192.168.0.1
route del default dev gprs0
 
Posts: 162 | Thanked: 351 times | Joined on Apr 2006 @ Cotswolds, UK
#4
Originally Posted by lakshman.mn View Post
Tried the hack but got an error
"/bin/sh: ssdp-fake.py: not found"
You probably copied the ssdp-fake.py script to a different directory, for example the MyDocs directory.

Try "./MyDocs/ssdp-fake.py <server>". If that does not work, use the "ls" command (the Linux directory listing command) to find where you have put ssdp-fake.py.

Originally Posted by sconf
Does anybody use this "fake" advertisement with standard Media player?
I do. When I run the N900 Media Player while ssdp-fake.py is running I get an icon and text in the bottom left of the main screen with the name of my remote media server. If I touch that I can then see the files my server is exporting.

Maybe the fake announcements I create aren't right for your media server and, for some reason, Mediabox and Zhaan don't care but the Media Player does?

If you want, you can use the script to see what announcements your media server is actually making. You need to run it on a system which is on the same LAN as the server and tell it to advertise a server which does not exist and then watch what multicast NOTIFY messages it reports seeing. The command would be something like: "./ssdp-fake.py -a 1.1.1.1" (I can't remember if the -a is needed). You will need to leave it several minutes. You should see something a bit like:

Code:
Received multicast from 192.168.0.238:32776
NOTIFY * HTTP/1.1
HOST:239.255.255.250:1900
CACHE-CONTROL:max-age=1810
LOCATION:http://192.168.0.238:8200/rootDesc.xml
SERVER: Linux/2.6.22.18-6281 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.0
NT:urn:schemas-upnp-org:device:MediaServer:1
USN:uuid:4d696e69-444c-164e-9d41-c03f0ea4ef10::urn:schemas-upnp-org:device:MediaServer:1
NTS:ssdp:alive
Maybe that would show you what you need to change in the fake announcements.

Graham
 
Posts: 840 | Thanked: 823 times | Joined on Nov 2009
#5
Originally Posted by Graham Cobb View Post
Try "./MyDocs/ssdp-fake.py <server>". If that does not work, use the "ls" command (the Linux directory listing command) to find where you have put ssdp-fake.py.
That would not work since scripts are not executable in mydocs by default. It's likely that is why it's not working for him/her.

I recommend you save it somewhere other than Mydocs and make sure you set the executable bit.
 

The Following User Says Thank You to Cue For This Useful Post:
Posts: 87 | Thanked: 56 times | Joined on Nov 2008
#6
Originally Posted by Graham Cobb View Post
If you want, you can use the script to see what announcements your media server is actually making.
Thanks for the tip. I forgot to mention that I'm also using MiniDLNA server. No big differences in multicasts, except they come slightly different order and this line

NT:urn:microsoft.com:service:X_MS_MediaReceiverReg istrar:1

Changing that line did not help.

However, I noticed that Zhaan is key. If Zhaan is not running, Mediabox don't discover server. As soon as Zhaan is running, both Mediabox and Zhaan find server, Media player don't. Zhaans seems to duplicate the multicast messages that ssdp-fake is creating (and ssdp-fake ignores them).

Maybe Zhaan is doing also something else besides multicasting. Oh well, I'm glad I get at least the Mediabox running with ssdp-fake and Zhaan.
 
Posts: 162 | Thanked: 351 times | Joined on Apr 2006 @ Cotswolds, UK
#7
Originally Posted by sconf View Post
However, I noticed that Zhaan is key. If Zhaan is not running, Mediabox don't discover server. As soon as Zhaan is running, both Mediabox and Zhaan find server, Media player don't. Zhaans seems to duplicate the multicast messages that ssdp-fake is creating (and ssdp-fake ignores them).
I don't understand why you are seeing different behaviour from me (I am not running Zhaan) but I am not an expert on this at all! I do note that my hack reacts to seeing any M-SEARCH multicasts flying around by sending its own multicast out again (it doesn't actually parse the message or respond with a unicast). So, having Zhaan running will probably increase the number of times the announcements get sent.

I guess the real answer is a full remote DLNA implementation (which someone was working on in last year's GSoC but I don't think was completed).

Until then, this is something which seems to work for me but it looks like it may not work for other people -- sorry.

Graham
 
Posts: 87 | Thanked: 56 times | Joined on Nov 2008
#8
Originally Posted by Graham Cobb View Post
So, having Zhaan running will probably increase the number of times the announcements get sent.
Yes, it does increase the announcements. I also reduced the announcement interval in ssdp-fake, but that would not help alone. It might be something in the tunneling which makes difference between your and my setup.

Originally Posted by Graham Cobb View Post
Until then, this is something which seems to work for me but it looks like it may not work for other people -- sorry.

Graham
Don't be sorry, it is great work-around, at least for me. I just need to start Zhaan for a second, and then I can use Mediabox, while waiting for that full remote DLNA implementation.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 18:54.