Can't access the VLC web interface with mIRC

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
User avatar
Devilin Pixy
New Cone
New Cone
Posts: 7
Joined: 24 Mar 2011 18:03
VLC version: 4.0-435 NB
Operating System: Win10(64)
Location: Netherlands
Contact:

Can't access the VLC web interface with mIRC

Postby Devilin Pixy » 26 Dec 2013 09:38

I use my own mIRC chat bot to connect to the VLC web interface to read all kinds of info from http://localhost:8080/requests/status.xml like artist, title, duration etc. as well as having viewers in my live stream post YouTube links to be added to the VLC playlist automatically. Since I updated to version 2.1.1 a password is needed. It was not hard to get the browser to show the interface again, but my mIRC chat bot is no longer capable of showing this information or to pass on the YouTube links to the playlist. Obviously I would need to connect using a password now, but I don't have a clue how to do this. I am using sockets to GET the info or to enqueue the YT links and most likely need to POST the password somehow using sockets. I would be able to login to websites this way (which seems similar) since I can view the source code of the HTML and find the fields needed (usually a form using cookies), but I can't seem to get the source for the popup window for the VLC web interface asking for the password.

Can anyone get me on my way to fix this problem or to somehow just disable the need for a password? For now all VLC functionality I use in my chat bot is broken and I am forced to switch back to an older version of VLC. I just can't disappoint my viewers who so love these features I use. Any help is greatly appreciated.
:roll: You cannot depend on your eyes when your imagination is out of focus. (Mark Twain) :roll:

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Can't access the VLC web interface with mIRC

Postby Jean-Baptiste Kempf » 26 Dec 2013 21:25

Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

User avatar
Devilin Pixy
New Cone
New Cone
Posts: 7
Joined: 24 Mar 2011 18:03
VLC version: 4.0-435 NB
Operating System: Win10(64)
Location: Netherlands
Contact:

Re: Can't access the VLC web interface with mIRC

Postby Devilin Pixy » 27 Dec 2013 02:06

Thanks for the response Jean-Baptiste,

That will not work in mIRC when using sockets. I can login and open the web interface just fine and my mIRC chat bot runs on the same computer. When I connect to the local address with mIRC, it's done with sockets. Here is the full script I am using in mIRC which is an older script, originally posted on Hawkee by TheNiteLyfe (http://www.hawkee.com/snippet/7593/). I revived it again and edited it for my own needs :

Code: Select all

; ---------------------------------------------- ; VLC show currently playing song/video ; Channel moderators can turn !playing ON or OFF ; ---------------------------------------------- alias vlc { if (!$sock(vlc)) { sockopen vlc 127.0.0.1 8080 /describe $chan says, now playing: sockmark vlc msg $chan } } on *:sockopen:vlc:{ sockwrite -nt vlc GET /requests/status.xml HTTP/1.1 sockwrite -nt vlc Host: 127.0.0.1 $str($crlf,2) } on *:sockread:vlc:{ if ($sockerr) { echo -a Error: $sock(vlc).wsmsg } var %v sockread %v if (<state>stopped</state> isin %v || <state>paused</state> isin %v ) { msg $active Not playing any Song/Video! | sockclose vlc } else { if ($regex(%v,/<(length)>([^>]+)<\/length>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(now_playing)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(artist)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(description)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(filename)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(album)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(title)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ($regex(%v,/<info name='(genre)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } if ((</root> isin %v) && (%v.le == 0) && (!%v.ge)) { $sock(vlc).mark %v.no %v.de | $sock(vlc).mark [Station: $+ $chr(32) %v.ti $+ ] unset %v.* sockclose vlc } if ((</root> isin %v) && (%v.le == 0)) { $sock(vlc).mark %v.no %v.de $sock(vlc).mark (Genre: $+ $chr(32) %v.ge $+ ) $sock(vlc).mark (Station: $+ $chr(32) %v.ti $+ ) unset %v.* sockclose vlc } if ((</root> isin %v) && (%v.le != 0) && (%v.fi)) { if !$read(YT - Playlist.m3u, ntw, $+(*,%v.fi,*)) { $sock(vlc).mark %v.fi $sock(vlc).mark [YouTube- $+ %v.ar $+ ] duration: ( $+ $duration(%v.le,3) $+ ) unset %v.* sockclose vlc } else { $read(YT - Playlist.m3u, ntw, $+(*,%v.fi,*)) var %line = $readn + 2 var %reqname = $remove($read(YT - Playlist.m3u, nt, %line),$chr(35)) $sock(vlc).mark %v.fi $sock(vlc).mark [YouTube- $+ %v.ar $+ ] duration: ( $+ $duration(%v.le,3) $+ ) $sock(vlc).mark Requested by: %reqname unset %v.* sockclose vlc } } if ((</root> isin %v) && (%v.le != 0)) { $sock(vlc).mark %v.ar - %v.ti $sock(vlc).mark (Album: $+ $chr(32) %v.al $+ ) $sock(vlc).mark (Genre: $+ $chr(32) %v.ge ) unset %v.* sockclose vlc } } } alias -l hf { return $remove($replace($1-,",",&apos;,',&,&,<,<,>,>,&nbsp;,$chr(32),','),<![CDATA[,]]>) }
It will 'sockread' and 'sockmark' using regex to show different information received from the page on local host (/requests/status.xml). Used to work perfectly fine, but now the password input prior to the page is making it malfunction now. This script now never even gets to the 2nd part where it has the 'on sockopen'. I would have to somehow know how the password popup (form/cookie) is done to then be able to use 'sockwrite' and pass on the password to this popup, most likely using 'POST' instead of 'GET'. Not sure if you, or anyone else is familiar with mIRC scripting, but I can't just make it connect to the address you suggested like that, since sockets just don't work that way.

As for the request songs being added by viewers in chat to the playlist in VLC. This is done in a similar way and using sockets as well. It will 'sockwrite' a stripped and edited YouTube link to the web interface:

Code: Select all

alias requests { sockopen requests 127.0.0.1 8080 } on *:sockopen:requests:{ sockwrite -nt requests GET /requests/status.xml?command=in_enqueue&input= $+ %ytURL HTTP/1.1 sockwrite -nt requests Host: 127.0.0.1 $str($crlf,2) echo -a 0,1 Song/Video added to VLC playlist! }
There is more scripting to this all, but this is basically the main part.

I will search some more and try to fiddle with it some more to get it to work, but I am not all knowing when it comes to mIRC scripting. I will see if your suggestion for the way to connect can somehow work out, but I could definitely use some more specific help on this.
:roll: You cannot depend on your eyes when your imagination is out of focus. (Mark Twain) :roll:

SilverstarX
New Cone
New Cone
Posts: 3
Joined: 06 Jan 2014 12:52

Re: Can't access the VLC web interface with mIRC

Postby SilverstarX » 06 Jan 2014 13:04

I've never done mirc scripting, but maybe this helps you.
You described a "pop up window" requesting username and password, so I guess it's basic http authentification. So, send the username and password in the form described here http://en.wikipedia.org/wiki/Basic_acce ... lient_side (base64 encoding and so on) somehow with sockwrite before (or after? I don't know) requesting the page itself.

User avatar
Devilin Pixy
New Cone
New Cone
Posts: 7
Joined: 24 Mar 2011 18:03
VLC version: 4.0-435 NB
Operating System: Win10(64)
Location: Netherlands
Contact:

Re: Can't access the VLC web interface with mIRC

Postby Devilin Pixy » 07 Jan 2014 15:49

Using sockets with mIRC works different from basic access authentication. I would need to know the header(s) of the popup form to send information to this form (username/password). Then I will most likely receive cookie(s) that need to be stored. Then I can establish a connection using sockwrite (POST method) with all the info needed to actually login.

Really hope someone can help me out.
:roll: You cannot depend on your eyes when your imagination is out of focus. (Mark Twain) :roll:


Return to “Web and scripting”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests