Page 1 of 1

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

Posted: 02 Mar 2020 20:25
by zotz
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

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

Posted: 02 Mar 2020 21:55
by zotz
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

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

Posted: 05 Jun 2020 11:33
by poutounours
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.

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

Posted: 16 Oct 2021 00:56
by wmodes
Trying to bump up this question. There seems little point to having an HTTP interface if you cannot add new items to the playlist.

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

Posted: 30 Nov 2023 04:08
by homsar47
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.