Simple python over the network media player to playback on DLNA/UPnP devices
Enjoy music on your favorite sound system or share a picture or YouTube video with your folks and friends on smart TV. Simple network player for DLNA/UPnP devices allows you discover devices and playback media on them.
dlnap.py   
--ipip address for faster access to the known device
--devicediscover devices with this name as substring
--listdefault command. Lists discovered UPnP devices in the network
--playset current url for play and start playback it. In case of empty url - continue playing recent media
--pausepause current playback
--stopstop current playback
--allflag to discover all upnp devices, not only devices with AVTransport ability
--proxyuse sync local download proxy, default is ip of current machine
--proxy-portport for local download proxy, default is 8000
List devices which are able to playback media only ```
dlnap.py Discovered devices: [a] Receiver rx577 @ 192.168.1.40 [a] Samsung TV @ 192.168.1.35 ```
List all available UPnP devices ```
dlnap.py --all Discovered devices: [x] ZyXEL Keenetic Giga @ 192.168.1.1 [a] Samsung TV @ 192.168.1.35 [x] Data @ 192.168.1.50 [a] Receiver rx577 @ 192.168.1.40 ```
[a] means that devices allows media playback
[x] means that device doesn't allow media playback
Playback music ```
dlnap.py --ip 192.168.1.40 --play http://somewhere.com/music.mp3 Receiver rx577 @ 192.168.1.40**Playback video**dlnap.py --device tv --play http://somewhere.com/video.mp4 Samsung TV @ 192.168.1.35**Show image**dlnap.py --device tv --play http://somewhere.com/image.jpg Samsung TV @ 192.168.1.35**Local files**dlnap.py --device tv --play ~/media/video.mp4 --proxy Samsung TV @ 192.168.1.35 ```
YouTube links ```
dlnap.py --device tv --play https://www.youtube.com/watch?v=q0eWOaLxlso Samsung TV @ 192.168.1.35 ``` Note: requires youtube-dl installed
Some devices doesn not able to play
httpslinks or links pointed outside of the local network.
dlnap.pytool allows to redirect such links to embeded download proxy.
The following command will set up a local http server at
http://:8000and tells TV to download file
http://somewhere.com/video.mp4from this http server:
dlnap.py --device tv --play http://somewhere.com/video.mp4 --proxy ```
So behind the scene the command looks like:
dlnap.py --device tv --play 'http://:8000/http://somewhere.com/video.mp4'**Note:** proxy is syncronous which means thatdlnap.py``` will not exit while device downloading file to playback.
In general device can playback direct links to a video file or a stream url only.
There are tools to convert (YouTube) url to stream url, e.g youtube-dl tool.
Assuming you have download proxy up and running at
http://:8000you can now play a video using command:
dlnap.py --device tv --play http://:8000/youtube-dl -g https://www.youtube.com/watch?v=q0eWOaLxlsoSamsung TV @ 192.168.1.35 ```