a simple cli upnp/dlna browser

22 Jan 2016

Last weekend I installed a usb hard disk to my openwrt router, added some content, setup minidlna and called it a day, easy way to stream movies locally. I tested the setup with all my endpoints and while it worked great with most of them I was having problems streaming to my Linux laptop, that’s funny considering the router itself runs the same OS.

Looking around I read suggestions about installing vlc,totem,xbmc,etc. All of those media players are great however I already have mplayer2 which is able to play http streams, that’s a great deal about upnp/dlna. So I took some time to hack a quick and dirty script and that’s how simple-dlna-browser was born.

$ simple-dlna-browser
Usage: simple-dlna-browser [OPTIONS] PATTERN

Examples

$ simple-dlna-browser -l #autodetection requires 'socat'
http://192.168.1.254:8200/rootDesc.xml (Multimedia)
┬
├── Apocalipto
├── Contacto
├── Coraline.y.la.puerta.secreta
...

$ simple-dlna-browser contacto | xargs mplayer

$ simple-dlna-browser -s 192.168.1.254 contacto | xargs mplayer

I used minidlna 1.1.4-2 as a reference, so it may not work with other media servers.

That’s it, happy streaming 😋