Skip to content
Advertisement

VLC – Get played file path

I would like to get the path of the file currently played by vlc. It seems that information can be obtained using the http server of vlc.

Since I don’t know much about http, I was not able to do it even with the help of the previous link or the vlc documentation.

To start an http server, I am supposed to use the command vlc -I http.

First question: Since this command does not open a vlc window, should I open a vlc window by myself after using this command? Or before? Or maybe it does not matter?

So I chose to first use the command, then open a vlc window and play an mp3 file in it.

To get information from vlc, the first link says:

You can then retrieve player status and track information by issuing a GET request to http://127.0.0.1:8080/requests/status.xml

I am not sure how to do a GET request. I tried wget:

~$ wget http://127.0.0.1:8080/requests/status.xml
--2020-12-22 12:17:22--  http://127.0.0.1:8080/requests/status.xml
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... 401 Client error

Username/Password Authentication Failed.

I tried to add my username and password but it did not work:

~$ wget --user my_username --password my_password http://127.0.0.1:8080/requests/status.xml
--2020-12-22 12:18:31--  http://127.0.0.1:8080/requests/status.xml
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... 401 Client error
Authentication selected: Basic realm="VLC stream"
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... 401 Client error

Username/Password Authentication Failed.

I tried to follow the advice in the vlc documentation:

Use a browser to go to http://your_host_machine:port

I went to http://localhost:8080 (which seemed the most likely host machine and port) but similarly to wget I am asked a username and a password and I don’t know which ones I am supposed to set.

I found here that the username should be left empty and that the password could be set in vlc parameters > Interface > Main interfaces > Lua. So I set a password and a source directory in the section “Lua HTTP”. Now when I use http://localhost:8080 I can enter my password and I see the list of the files in the source directory that I specified.

With all that, the wget command still returns the same output.

Second question: Could you tell my how to make it work?

OS: Ubuntu 20.04.1

VLC version: 3.0.11

Advertisement

Answer

You will need to set an admin password when you start VLC with the flag:

--http-password 

You should then be able to run wget or curl with the admin username and the password specified to get the information.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement