Advertisement
illpastethat

Last.FM now playing tiyui

Feb 22nd, 2013
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.15 KB | None | 0 0
  1. ;This sript was originally written by Jethro @ Hawkee.com
  2. ;Minor revisions added by illhawkthat @ Hawkee.com
  3. on $*:text:/[!.@]lastfm( |$)/iS:*:{
  4.   .ignore -cpu3 $nick 2
  5.   if (!$2) {
  6.     if ($($+(%,lastfm,.,$nick),2) != $null) {
  7.       $np($($+(%,lastfm,.,$nick),2))
  8.       halt
  9.     }
  10.     else {
  11.       msg $chan $nick - Syntax $1 <username> :: To set your username permanently type $replace($1,lastfm,setlastfm) <username>
  12.       halt
  13.     }
  14.   }
  15.   $np($strip($2))
  16. }
  17. on $*:text:/[!.@]setlastfm( |$)/iS:*:{
  18.   set $+(%,lastfm,.,$nick) $iif($2,$2,$nick)
  19.   msg $chan $nick your associated Last.FM profile is now $($+(%,lastfm,.,$nick),2)
  20. }
  21. alias -l lastfm {
  22.   return $replace($1,&gt;,>,&lt;,<,&amp;,&)
  23. }
  24. on *:sockread:lastfm*:{
  25.   tokenize 96 $sock($sockname).mark
  26.   var %lf = $sockname
  27.   if ($sockerr) {
  28.     $2 $me is having difficulty reading the data from last.fm!
  29.     halt
  30.   }
  31.   sockread &lastfm
  32.   if ($regex([ [ $4 ] ],/<error code="6">(.*)</error></lfm>)) {
  33.     $2 $+($regml(1),!)
  34.     halt
  35.   }
  36.   elseif (nowplaying !isin [ [ $4 ] ]) {
  37.     $2 $1 isn't playing music right now!
  38.     sockclose %lf
  39.   }
  40.   else {
  41.     $2 Last.fm_NP : $+($chr(9833),$chr(9834),$chr(9835)) $+($chr(2),$&
  42.       $lastfm($gettok($gettok([ [ $4 ] ],6,62),1,60)),$chr(2)) - $+($chr(2),$&
  43.       $lastfm($gettok($gettok([ [ $4 ] ],8,62),1,60)),$chr(2)) $&
  44.       $+($chr(9833),$chr(9835),$chr(9836))
  45.     sockclose %lf
  46.   }
  47. }
  48. on *:sockopen:lastfm*:{
  49.   tokenize 96 $sock($sockname).mark
  50.   if ($sockerr) {
  51.     $2 $me is having difficulty connecting to lastfm's website!
  52.     halt
  53.   }
  54.   $5 GET $+(/2.0/?method=user.getrecenttracks&user=,$1,&api_key=,$3) HTTP/1.1
  55.   $5 Host: $sock($sockname).addr
  56.   $5 Connection: close
  57.   $5
  58. }
  59. alias np {
  60.   if (!$1) {
  61.     .notice $iif($isid,$nick,$me) Please enter a user name! e.g. /np <UserName>
  62.     halt
  63.   }
  64.   var %lastfm $+(lastfm,$r(1,9999),$ticks,$network,$cid)
  65.   $+(sock,$iif($sock(%lastfm),close,open)) %lastfm ws.audioscrobbler.com 80
  66.   sockmark %lastfm $+($1,`,$iif($isid,.describe $iif(#,#,$nick),echo -at *),`,f6a3b7b12549aa211a6deec453c79417$&
  67.     ,`,$!bvar(&lastfm,1-).text,`,sockwrite -nt %lastfm)
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement