VLC now playing script
This script is a simplification from one I found online @ http://forums.mirc.com/ubbthreads.php/topics/245127/VLC_-_Now_Playing_Script!
/np will post the current track information into the active window.
alias np {
sockclose vlc
sockopen vlc localhost 8080
}
on *:sockopen:vlc:{
if $sockerr > 0 { echo -at vlc not running | sockclose vlc }
sockwrite -n $sockname GET /requests/status.xml HTTP/1.1
sockwrite -n $sockname Host: localhost
sockwrite -n $sockname Authorization: Basic $encode(:password,m)
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on *:sockread:vlc: {
if $sockerr > 0 { echo -a error | sockclose vlc }
sockread %vlcx
if ($regex(%vlcx,<info name='title'>(.*?)</info>)) {
set %title $regml(1)
}
if ($regex(%vlcx,<info name='artist'>(.*?)</info>)) {
set %artist $regml(1)
}
if ($regex(%vlcx,<info name='Bitrate'>(.*?)</info>)) {
set %bitrate $regml(1)
}
if ($regex(%vlcx,<length>(.*?)</length>)) {
set %length $regml(1)
}
if (</root> iswm %vlcx) {
msg $active Now Playing: %artist - %title @ %bitrate Length: $duration(%length)
unset %artist %title %bitrate %vlcx %length
}
}