Devilin_Pixy commented on a Page, VLC Now Playing  -  Aug 19, 2012

@Ragematix Ok, here is the full script as TheNitelyfe started it with the changes to make it work. This is not the actual script I use myself. I added a debug window to the script which will show the actual output from the status.xml in line 14 and 17. I use this script myself but made changes to display the fields I want it to show in a way I like and made quite a few more edits myself. I added the debug window to make it easier to understand the way this script works to allow your own edits and use other fields if you like. That would need editing this code of course.

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 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: $str($crlf,2)
on *:sockread:vlc:{
  if ($sockerr) { echo -a Error: $sock(vlc).wsmsg }
  window -de @ $+ $sockName -1 -1 500 500
  var %v
  sockread %v
  aline -p @ $+ $sockName : $+ %v
  if (<state>stopped</state> isin %v || <state>paused</state> 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 (</root> isin %v) { 
      $sock(vlc).mark [VLC] (Type:) %v.ty >> - %v.ti < $+ $+ > (Length:) %v.le (Bit Rate:) ( $+ $+ ) 
      unset %v.*
      sockclose vlc
alias -l hf { return $remove($replace($1-,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#39;,'),<![CDATA[,]]>) }

Any questions, just reply in this thread since I am still following this post.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.