Winamp Control w/ WAWI
Posted by cr4z3d01
Saturday, June 11, 2005
Description: simple way to control winamp from mirc

The point of this was to use the pluggin WAWI (www.flippet.org/wawi) which is a simple web interface for winamp. It's pretty nice to use when you have a computer hooked up with speakers and are chilling in a comfy chair and don't want to get up to change the songs. I've taken a good look at it and come up with this so that you don't even have to open up a browser to control winamp. Here's the code:


on *:SOCKOPEN:WinAmp: {
  sockwrite -n $sockname GET / $+ %wa.command HTTP/1.1
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
}
on *:SOCKREAD:WinAmp: {
  if ($sockerr) {
    echo -a $sock($sockname).wsmsg
    halt
  }
  elseif (%wa.command == title) {
    sockread -f %wa.temp
    if (<body isin %wa.temp) {
      $iif(%wa.global == 1,msg $active Winamp:,echo -a) $nohtml(%wa.temp)
      sockclose $sockname
    }
  }
  else {
    sockclose $sockname
  }
}
alias song {
  set %wa.command title
  if ($1 = g) {
    set %wa.global 1
  }
  else {
    unset %wa.global
  }
  SendCommand
}
alias next {
  set %wa.command next
  echo -a Next command sent
  SendCommand
}
alias prev {
  set %wa.command prev
  echo -a Prev command sent
  SendCommand
}
alias stop {
  set %wa.command stopslow
  echo -a Stop command sent
  SendCommand
}
alias play {
  set %wa.command play
  echo -a Play command sent
  SendCommand
}
alias pause {
  set %wa.command pause
  echo -a Pause command sent
  SendCommand
}
alias vol {
  if (!$1) || ($1 > 10) || ($1 < 1) {
    echo -a Please enter a number between 1 and 10.
  }
  else {
    set %wa.command vol?volume= $+ $1
    echo -a Volume changed to $1
    SendCommand
  }
}
alias mute {
  if (%mute) {
    set %wa.command vol?volume=10
    unset %mute
    echo -a Unmuted
  }
  else {
    set %wa.command vol?volume=0
    set %mute 1
    echo -a Muted
  }
  SendCommand
}
alias random {
  if (%random) {
    set %wa.command playmode?random=off
    unset %random
    echo -a Random mode set to off
  }
  else {
    set %wa.command playmode?random=on
    set %random 1
    echo -a Random mode set to on
  }
  SendCommand
}
alias repeat {
  if (%repeat) {
    set %wa.command playmode?repeat=off
    unset %repeat
    echo -a Repeat mode set to off
  }
  else {
    set %wa.command playmode?repeat=on
    set %repeat 1
    echo -a Repeat mode set to on
  }
  SendCommand
}
alias SendCommand {
  sockopen WinAmp 192.168.0.4 80 ;; Replace with your host and port of WAWI
}




i added a global say of the song.. just use /song g
Oops, i did it again
Posted by PaigmaVejenna
Tuesday, June 21, 2011 04:50pm PDT
This is my first message. Please don't delete it. Thanks
jsh39shd2 <a href=http://hsk39sg3.com>link</a>
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world