Is there a way to get the currently playing item in the vlc media player using command line or python in ubuntu ?
VLC has a mini web server included that supports macros that you can use to query the current item, time left, etc.
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