VLC Now Playing
Platform: mIRC
Published Apr 28, 2010
Updated Jul 24, 2012
Now playing script for the best media player out there. Obviously you gotta have the VLC media player to use this script. Usage: /vlc -l to echo or -m to message active window. To use this, first you must open VLC and go to View > Add Interface > Web Interface, and you might get a firewall pop up, just click allow. All set.
alias vlc {
if (!$istok(-l -m,$1,32)) { echo 2 -ta * /vlc insufficient paramaters: /vlc -l to echo, -m to message active | return }
if (!$sock(vlc)) {
sockopen vlc 127.0.0.1 8080
sockmark vlc $iif($1 == -m,msg $active,echo -a)
}
}
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 (<length>0</length> isin %v) { echo -a Error: Not playing any songs! | sockclose vlc }
else {
if ($regex(%v,/<(length)>([^>]+)<\/length>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
if ($regex(%v,/<info name='(artist|album|title|bitrate|type|sample rate)'>([^>]+)<\/info>/i)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) } }
if (</information> isin %v) {
$sock(vlc).mark [VLC] (Type:) %v.ty >> %v.ar - %v.ti < $+ %v.al $+ > (Length:) %v.le (Bit Rate:) %v.bi ( $+ %v.sa $+ )
unset %v.*
sockclose vlc
}
}
}
alias -l hf { return $remove($replace($1-,",",',',&,&,<,<,>,>, ,$chr(32),','),<![CDATA[,]]>) }