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.
- Python (whatever you like: python 2.7+ or python3)
- youtube-dl to playback YouTube links
- Fix '&' bug
- Set next media
- Volume control
- Position control
- Add support to play media from local machine, e.g --play /home/username/media/music.mp3 for py3
- Try it on Windows
- Add AVTransport:2 and further support
- Play on multiple devices
- Integrate local download proxy
- Stop/Pause playback
- Investigate if it is possible to play images/videos on DLNA/UPnP powered TV (possible via download proxy)
- Yamaha RX577
- Samsung Smart TV (UE40ES5507) via proxy
- Marantz MR611
- Kodi
- Volumio2 (?)
- Pioneer MRX-3 via proxy and timeout >= 2
- please email me if it works or doesn't work with your device
pip install -r requirement.txt
dlnap.py [<selector>] [<command>] [<feature>]
Selectors:
--ip <device ip>
ip address for faster access to the known device
--device <device name or part of the name>
discover devices with this name as substring
Commands:
--list
default command. Lists discovered UPnP devices in the network
--play <url>
set current url for play and start playback it. In case of empty url - continue playing recent media
--pause
pause current playback
--stop
stop current playback
--set-next <url>
set the next media url to be played (gapless)
--next
play the next media
Features:
--all
flag to discover all upnp devices, not only devices with AVTransport ability
--proxy
use sync local download proxy, default is ip of current machine
--proxy-port
port for local download proxy, default is 8000
--timeout <seconds>
discover timeout
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
where
[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 https
links or links pointed outside of the local network.
For such cases dlnap.py
tool allows to redirect such links to embeded download proxy.
Example:
The following command will set up a local http server at http://<your ip>:8000
and tells TV to download file http://somewhere.com/video.mp4
from 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://<your ip>:8000/http://somewhere.com/video.mp4'
Note: proxy is syncronous which means that dlnap.py
will not exit while device downloading file to playback.
YouTube/Vimeo/etc videos
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://<proxy ip>:8000
you can now play a video using command:
> dlnap.py --device tv --play http://<proxy ip>:8000/`youtube-dl -g https://www.youtube.com/watch?v=q0eWOaLxlso`
Samsung TV @ 192.168.1.35