Git Product home page Git Product logo

dlnap's Introduction

dlnap

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.

Requires

  • Python (whatever you like: python 2.7+ or python3)
  • youtube-dl to playback YouTube links

TODO

  • 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 possible to play images/video's on DLNA/UPnP powered TV (possible via download proxy)

Supported devices/software

  • Yamaha RX577
  • Samsung Smart TV (UE40ES5507) via proxy
  • Marantz MR611
  • Kodi
  • Volumio2 (?)
  • please email me if it works or doesn't work with your device

Usage

Overview

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
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

Discover UPnP devices

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 media

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

Proxy

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.

We need to go deeper :octocat:

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.