Control running vlc/cvlc instance via http interface using either wget or curl from a script

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
zotz
New Cone
New Cone
Posts: 2
Joined: 02 Mar 2020 17:32

Control running vlc/cvlc instance via http interface using either wget or curl from a script

Postby zotz » 02 Mar 2020 20:25

A Little Background:

I am trying to get the Rivendell Radio Automation software to use vlc to play videos where it wants to play audio. If anyone is interested in this and it is appropriate here, I can add links to a github repository and a wiki page.

I try starting vlc on the machine that will play the videos like this:

/usr/bin/cvlc --fullscreen -I rc --rc-host 192.168.86.145:4212 --extraintf http --http-src /usr/share/vlc/lua/http --http-host 192.168.86.145 --http-port 9090 --http-password foo

Cut to the chase:

in a browser, this works:

http://192.168.86.145:9090/requests/status.xml?command=in_enqueue&input=file:///var/vid/700011.mp4

From a terminal, this fails:

Code: Select all

curl -u ':foo' --data-urlencode "input=file:///var/vid/700012.mp4" http://192.168.86.145:9090/requests/status.xml?command=in_enqueue
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Error loading /requests/status.xml</title>
</head>
<body>
<h1>Error loading /requests/status.xml</h1><pre>lua/intf/modules/httprequests.lua:96: bad argument #1 to &#39;make_uri&#39; (string expected, got nil)</pre>
<p>
<a href="http://www.videolan.org/">VideoLAN</a><br/>
<a href="http://www.lua.org/manual/5.1/">Lua 5.1 Reference Manual</a>
</p>
</body>
</html>
From a terminal, this fails:

Code: Select all

wget -O zzz.txt -d --user="" --password=foo http://192.168.86.145:9090/requests/status.xml?command=in_enqueue&input=file:///var/vid/700012.mp4
with this at the end of the wget log:

Code: Select all

---response end--- 200 OK Length: 420 [text/xml] Saving to: ‘zzz.txt’ zzz.txt 100%[===================>] 420 --.-KB/s in 0s Closed fd 5 2020-03-02 14:15:09 (46.0 MB/s) - ‘zzz.txt’ saved [420/420]
and this in zzz.txt:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Error loading /requests/status.xml</title>
</head>
<body>
<h1>Error loading /requests/status.xml</h1><pre>lua/intf/modules/httprequests.lua:96: bad argument #1 to &#39;make_uri&#39; (string expected, got nil)</pre>
<p>
<a href="http://www.videolan.org/">VideoLAN</a><br/>
<a href="http://www.lua.org/manual/5.1/">Lua 5.1 Reference Manual</a>
</p>
</body>
</html>
Can someone give me a working example of adding a file to a playlist using wget or curl from a terminal?

I seem to be able to get curl/wget to work when I am only trying to "get" info back from the http interface / status.xml, but when I am trying to enqueue or delete a playlist entry, I cannot get anything to work.

Thanks in advance...

I am trying to figure this out so I can drop the rc interface all together as I have been advised that
the RC interface cannot be reliably accessed more than once
...

drew

zotz
New Cone
New Cone
Posts: 2
Joined: 02 Mar 2020 17:32

Re: Control running vlc/cvlc instance via http interface using either wget or curl from a script

Postby zotz » 02 Mar 2020 21:55

Some progress on the wget side of things and deleting items from the playlist:

This works for deleting:

Code: Select all

wget -O zzz.txt -d --user="" --password=foo "http://192.168.86.145:9090/requests/status.xml?command=pl_delete&id=3"
It does not work without the quotes around the URL like this:

Code: Select all

wget -O zzz.txt -d --user="" --password=foo http://192.168.86.145:9090/requests/status.xml?command=pl_delete&id=3
all the best,

drew

poutounours
New Cone
New Cone
Posts: 2
Joined: 05 Jun 2020 11:31

Re: Control running vlc/cvlc instance via http interface using either wget or curl from a script

Postby poutounours » 05 Jun 2020 11:33

Hi,

I am trying to achieve "tv channel like" automation for VLC, so i think it is nearly the same thing as you are.
I would be glad to help if i can.

Regards.

wmodes
New Cone
New Cone
Posts: 1
Joined: 16 Oct 2021 00:50

Re: Control running vlc/cvlc instance via http interface using either wget or curl from a script

Postby wmodes » 16 Oct 2021 00:56

Trying to bump up this question. There seems little point to having an HTTP interface if you cannot add new items to the playlist.

homsar47
New Cone
New Cone
Posts: 2
Joined: 29 Nov 2023 23:35

Re: Control running vlc/cvlc instance via http interface using either wget or curl from a script

Postby homsar47 » 30 Nov 2023 04:08

Hoping to bump this as well. Seems like a common enough use case that I'd imagine a solution exists out there somewhere, I just haven't found one yet.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 6 guests