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-,",",',',&,&,<,<,>,>, ,$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.