Is there a way to get the currently playing item in the vlc media player using command line or python in ubuntu ?
-
I recall seeing somewhere that you can communicate with VLC via sockets. Maybe looking at this code might help you. – Joseph R. Apr 15 '13 at 20:58
VLC has a mini web server included that supports macros that you can use to query the current item, time left, etc.
Read here.
Although this is far from perfect, VLC ships with a little HTTP server integrated. It is used both to stream using HTTP, and for the HTTP remote control interface. To start VLC with the HTTP interface, use:
% vlc -I http (--http-src /directory/ --http-host host:port)
To get the current playlist item and time position, Try creating an html file containing this :
<vlc id="value" param1="stream_length" />
<vlc id="foreach" param1="pl" param2="playlist" />
<vlc id="if" param1="pl.current" />
<vlc id="value" param1="pl.uri" />
<vlc id="end" />
<vlc id="end" />
The method to get the current URI is really dirty, but I don't think we have a better one at the moment.
Place this file in the HTTP interface path (/usr/share/vlc/http, or /usr/local/share/http probably, or share/http in the source tree if you're running an uninstalled version).
Then, you can use
wget http://vlc_streamer:8080/your_file