SHARE
TWEET

Last.FM comprehensive tiyui

illpastethat Feb 23rd, 2013 182 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Original script by hxck found @ http://www.hawkee.com/snippet/9077/
  2. ;Small modifications made by nick1/illhawkthat
  3. ;Last edit February 23 2013
  4. alias lastAPIkey {
  5.   return f6a3b7b12549aa211a6deec453c79417
  6. }
  7. On *:START: {
  8.   if (!$hget(lastinfo)) { hmake lastinfo 20 }
  9.   if ($isfile(lastinfo.hsh)) { hload -s lastinfo lastinfo.hsh }
  10. }
  11.  
  12. On *:LOAD: {
  13.   if (!$hget(lastinfo)) { hmake lastinfo 20 }
  14.   if ($isfile(lastinfo.hsh)) { hload -s lastinfo lastinfo.hsh }
  15. }
  16.  
  17. on *:TEXT:!lfmhelp*:#: {
  18.   if ($2 == nr) {
  19.     .query $nick The New Releases command works 4 ways:
  20.     .query $nick 1. !lfmnr - This will show 5 (Default) recommended new albums based on the person who triggered it
  21.     .query $nick 2. !lfmnr <1-10> - This will show 1-10 (depending on what you chose) recommended new albums based on the person who triggered it
  22.     .query $nick 3. !lfmnr [username] - This will show 5 (default) recommended new albums based on username
  23.     .query $nick 4. !lfmnr [username] <1-10> - This will show 1-10 (depending on what you chose) recommended new albums based on username
  24.   }
  25.   if ($2 == compare) {
  26.     .query $nick The Taste-O-Meter works 2 ways:
  27.     .query $nick !lfmc user1 - This will compare user1 with the person who triggered it (assuming that person has added their Last.fm nick to the bot)
  28.     .query $nick !lfmc user1 user2 - This will compare user1 with user2
  29.   }
  30.   if (!$2) {
  31.     .query $nick !lfmhelp - for this list of commands
  32.  
  33.     .query $nick 3---Adding yourself to the bot
  34.     .query $nick --
  35.     .query $nick !lfma username :: Add yourself to the bot
  36.     .query $nick !lfmd username :: Remove yourself from the bot
  37.     .query $nick --
  38.     .query $nick 3---Basic information
  39.     .query $nick !lfm [username] :: Now Playing info
  40.     .query $nick !lfmu [username] :: Profile information on the specified user
  41.     .query $nick --
  42.     .query $nick 3---Advanced information
  43.     .query $nick !lfmc user1 [user2] :: Taste-O-Meter rating with another nick. Type !lfmhelp compare for more information.
  44.     .query $nick !lfms artist :: 10 artists similar to the one specified
  45.     .query $nick !lfmnr <1-10/username> [1-10] :: Recommended new album(s) based on your listening history. Type !lfmhelp nr for more information.
  46.     .query $nick !lfmta :: Top 10 overall artists on the Last.fm charts
  47.     .query $nick !lfmuta <overall|7day|3month|6month|12month> [username] :: Top 10 Artists for a specific period/user
  48.     .query $nick !lfmn [username] :: Top 10 recommended Neighbors for the specified user
  49.   }
  50. }
  51.  
  52. on *:TEXT:!lfm*:#: {
  53.   if ($sock(lfm)) { sockclose lfm }
  54.  
  55.   ; ===================
  56.   ; Add or Remove Users
  57.   ; ===================
  58.  
  59.   if ($1 == !lfma) {
  60.     hadd -m lastinfo $nick $2
  61.     hsave lastinfo lastinfo.hsh
  62.     msg # Added! Use !lfm or !lfmu
  63.   }
  64.   if ($1 == !lfmd) {
  65.     hdel lastinfo $nick $2
  66.     msg # User removed.
  67.   }
  68.  
  69.   ; =================
  70.   ; Set method 'Info'
  71.   ; =================
  72.  
  73.   if ($1 == !lfmu) {
  74.     if ($sock(lfm)) { sockclose lfm }
  75.     set %methodd info
  76.     if (!$2) {
  77.       if (!$hget(lastinfo, $nick)) {
  78.         msg # No such nick regged with the bot, please add one using !lfma <Last.FM Nick>  
  79.         halt
  80.       }
  81.       if $hget(lastinfo, $nick) {
  82.         set %username $hget(lastinfo, $nick)
  83.         set %method /2.0/?method=user.getinfo&user= $+ %username $+ &limit=1&api_key= $+ $lastAPIKey
  84.       }
  85.     }
  86.     if ($2) {
  87.       set %username $iif($hget(lastinfo, $2),$hget(lastinfo, $2),$2)
  88.       set %method /2.0/?method=user.getinfo&user= $+ %username $+ &limit=1&api_key= $+ $lastAPIKey
  89.     }
  90.     sockopen lfm ws.audioscrobbler.com 80
  91.     sockmark lfm msg # 4Last.fm »
  92.   }
  93.  
  94.   ; ===============
  95.   ; Set method 'NP'
  96.   ; ===============
  97.  
  98.   if ($1 == !lfm) {
  99.     if ($sock(lfm)) { sockclose lfm }
  100.     set %lfmnametemp 0
  101.     set %lfmartisttemp 0
  102.     set %lfmalbumtemp 0
  103.     set %methodd np
  104.     if (!$2) {
  105.       if (!$hget(lastinfo, $nick)) {
  106.         msg # No such nick regged with the bot, please add one using !lfma <Last.FM Nick>  
  107.         halt
  108.       }
  109.       if ($hget(lastinfo, $nick)) {
  110.         set %username $hget(lastinfo, $nick)
  111.         set %method /2.0/?method=user.getrecenttracks&user= $+ %username $+ &limit=1&api_key= $+ $lastAPIKey
  112.       }
  113.     }
  114.     if ($2) {
  115.       set %username $iif($hget(lastinfo, $2),$hget(lastinfo, $2),$2)
  116.       set %method /2.0/?method=user.getrecenttracks&user= $+ %username $+ &limit=1&api_key= $+ $lastAPIKey
  117.     }
  118.     sockopen lfm ws.audioscrobbler.com 80
  119.     set %lfm.chan #
  120.   }
  121.  
  122.   ;=====================
  123.   ; Set method 'Compare'
  124.   ;=====================
  125.  
  126.   if ($1 == !lfmc) {
  127.     set %methodd compare
  128.     if (!$2) { msg # You must provide a nickname to compare with. | halt }
  129.     if (!$3) {
  130.       if (!$hget(lastinfo,$nick)) { msg # You're not regged with the bot, please add one using !lfma <Last.FM Nick>, or do !lfmc <Last.FM Nick 1> <Last.FM Nick 2> | halt }
  131.       else {
  132.         set %lfmcu1 $hget(lastinfo,$nick)
  133.         set %lfmcu2 $iif($hget(lastinfo,$2),$hget(lastinfo,$2),$2)
  134.       }
  135.     }
  136.     if ($3) {
  137.       set %lfmcu1 $iif($hget(lastinfo,$2),$hget(lastinfo,$2),$2)
  138.       set %lfmcu2 $iif($hget(lastinfo,$3),$hget(lastinfo,$3),$3)  
  139.     }
  140.     set %method $+(/2.0/?method=tasteometer.compare&type1=user&type2=user&value1=,%lfmcu1,&value2=,%lfmcu2,&api_key= $+ $lastAPIKey )    
  141.     sockopen lfm ws.audioscrobbler.com 80
  142.     sockmark lfm msg # 4Last.fm 4»
  143.   }
  144.  
  145.   ;=====================
  146.   ; Set method 'Similar'
  147.   ;=====================
  148.  
  149.   if ($1 == !lfms) {
  150.     set %methodd similar
  151.     if (!$2) { msg # You must provide an artist. | halt }
  152.     set %method /2.0/?method=artist.getsimilar&artist= $+ $replace($2-,$chr(32),$chr(43)) $+ &autocorrect=1&limit=10&api_key= $+ $lastAPIKey
  153.     sockopen lfm ws.audioscrobbler.com 80
  154.     sockmark lfm msg # 4Last.fm 4»
  155.   }  
  156.  
  157.   ;==========================
  158.   ; Set method 'New Releases'
  159.   ;==========================
  160.  
  161.   if ($1 == !lfmnr) {
  162.     if (($2) && (!$3)) {
  163.       if ($2 isnum) {
  164.         if ($2 > 10) { msg # Sorry, but that'll be too many releases, please choose a number between 1 and 10 | halt }
  165.         if ($2 isnum 1-10) {
  166.           if (!$hget(lastinfo,$nick)) { msg $chan You're not regged with the bot, please add one using !lfma <Last.FM Nick> | halt }
  167.           set %lfmnrout $2
  168.           set %username $hget(lastinfo,$nick)
  169.         }
  170.       }
  171.       else {
  172.         set %lfmnrout 5
  173.         set %username $iif($hget(lastinfo,$2),$hget(lastinfo,$2),$2)
  174.       }
  175.     }
  176.     if (!$2) {
  177.       if (!$hget(lastinfo,$nick)) { msg $chan You're not regged with the bot, please add one using !lfma <Last.FM Nick> | halt }
  178.       else {
  179.         set %lfmnrout 5
  180.         set %username $hget(lastinfo,$nick)
  181.       }
  182.     }
  183.     if ($3) {
  184.       set %username $iif($hget(lastinfo,$2),$hget(lastinfo,$2),$2)
  185.       if ($3 > 10) { msg # Sorry, but that'll be too many releases, please choose a number between 1 and 10 | halt }
  186.       if ($3 isnum 1-10) { set %lfmnrout $3 }
  187.     }
  188.     set %methodd lfmnr
  189.     set %lfmnametemp 0
  190.     set %lfmnrtemp 0
  191.     set %method $+(/2.0/?method=user.getnewreleases&user=,%username,&api_key= $+ $lastAPIKey )
  192.     sockopen lfm ws.audioscrobbler.com 80
  193.     sockmark lfm msg # 4Last.fm 4»
  194.   }
  195.  
  196.   ;===============================
  197.   ; Set method 'Chart Top Artists'
  198.   ;===============================
  199.  
  200.   if ($1 == !lfmta) {
  201.     set %methodd lfmta
  202.     set %method http://ws.audioscrobbler.com/2.0/?method=chart.gettopartists&limit=10&api_key= $+ $lastAPIKey
  203.     sockopen lfm ws.audioscrobbler.com 80
  204.     sockmark lfm msg # 4Last.fm 4»
  205.   }
  206.  
  207.   ;==============================
  208.   ; Set method 'User Top Artists'
  209.   ;==============================
  210.  
  211.   if ($1 == !lfmuta) {
  212.     set %methodd lfmuta
  213.     if (!$2) { msg # You must provide a period of time. Acceptable inputs are: Overall, 7day, 3month, 6month and 12month. | halt }
  214.     if (($2) && (!$3)) {
  215.       if ($2 == overall) || ($2 == 7day) || ($2 == 3month) || ($2 == 6month) || ($2 == 12month) {
  216.         set %period $2
  217.         if (!$hget(lastinfo,$nick)) { msg # You're not regged with the bot, please add one using !lfma <Last.FM Nick> | halt }
  218.         set %username $hget(lastinfo,$nick)
  219.         set %method http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user= $+ %username $+ &period= $+ %period $+ &limit=10&api_key= $+ $lastAPIKey
  220.       }
  221.       else { msg # 4Last.fm 4» Acceptable inputs are: Overall, 7day, 3month, 6month and 12month. | halt }
  222.     }
  223.     if (($2) && ($3)) {
  224.       if ($2 == overall) || ($2 == 7day) || ($2 == 3month) || ($2 == 6month) || ($2 == 12month) {
  225.         set %period $2
  226.         set %username $iif($hget(lastinfo,$3),$hget(lastinfo,$3),$3)
  227.         set %method http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user= $+ %username $+ &period= $+ %period $+ &limit=10&api_key= $+ $lastAPIKey
  228.       }
  229.       else { msg # 4Last.fm 4» Acceptable inputs are: Overall, 7day, 3month, 6month and 12month. | halt }
  230.     }
  231.     if ($sock(lfm)) { sockclose lfm }
  232.     sockopen lfm ws.audioscrobbler.com 80
  233.     sockmark lfm msg # 4Last.fm 4»
  234.   }
  235.  
  236.   ;============================
  237.   ; Set method 'User Neighbors'
  238.   ;============================
  239.  
  240.   if ($1 == !lfmn) {
  241.     set %methodd lfmn
  242.     if (!$2) {
  243.       if (!$hget(lastinfo,$nick)) { msg # You're not regged with the bot, please add one using !lfma <Last.FM Nick> | halt }
  244.       set %username $hget(lastinfo,$nick)
  245.       set %method http://ws.audioscrobbler.com/2.0/?method=user.getneighbours&user= $+ %username $+ &limit=10&api_key= $+ $lastAPIKey
  246.     }
  247.     if ($2) {
  248.       set %username $iif($hget(lastinfo,$2),$hget(lastinfo,$2),$2)
  249.       set %method http://ws.audioscrobbler.com/2.0/?method=user.getneighbours&user= $+ %username $+ &limit=10&api_key= $+ $lastAPIKey
  250.     }
  251.     if ($sock(lfm)) { sockclose lfm }
  252.     sockopen lfm ws.audioscrobbler.com 80
  253.     sockmark lfm msg # 4Last.fm 4»
  254.   }
  255. }
  256.  
  257. ; ==================
  258. ; Connect the Socket
  259. ; ==================
  260.  
  261. on *:sockopen:lfm: {
  262.   sockwrite -n $sockname GET %method HTTP/1.1
  263.   sockwrite -n $sockname Host: ws.audioscrobbler.com
  264.   sockwrite -n $sockname Connection: close
  265.   sockwrite -n $sockname $crlf
  266. }
  267.  
  268. ; ===============
  269. ; Read the Socket
  270. ; ===============
  271.  
  272. on *:sockread:lfm: {
  273.   if ($sockerr) { $sock(lfm).mark Socket Error: $sock(lfm).wsmsg }
  274.   var %lfmtemp
  275.   sockread %lfmtemp
  276.  
  277.   ; =============
  278.   ; Set 'NP' vars
  279.   ; =============
  280.  
  281.   if (%methodd == np) {
  282.     if ((<name> isin %lfmtemp) && (%lfmnametemp == 0)) {
  283.       set %lfmname $replace($nohtml(%lfmtemp),&amp;,&,&quot;,")
  284.       set %lfmnametemp 1
  285.     }
  286.     if ((<artist isin %lfmtemp) && (%lfmartisttemp == 0)) {
  287.       set %lfmartist $replace($nohtml(%lfmtemp),&amp;,&,&quot;,")
  288.       set %lfmartisttemp 1
  289.     }
  290.     if ((<album isin %lfmtemp) && (%lfmalbumtemp == 0)) {
  291.       set %lfmalbum $replace($nohtml(%lfmtemp),&amp;,&,&quot;,")
  292.       set %lfmalbumtemp 1
  293.     }
  294.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  295.   }
  296.  
  297.   ; ==============
  298.   ; Set 'NP2' vars
  299.   ; ==============
  300.  
  301.   if (%methodd == np2) {
  302.     if (<duration> isin %lfmtemp) { set %lfm.length $nohtml(%lfmtemp) }
  303.     if (<userloved> isin %lfmtemp) {
  304.       if (<userplaycount> isin %lfmtemp) {
  305.         set %lfm.playcount $gettok($nohtml(%lfmtemp),1,32)
  306.         set %lfm.loved $gettok($nohtml(%lfmtemp),2,32)
  307.       }
  308.       else { set %lfm.loved $gettok($nohtml(%lfmtemp),1,32) }
  309.     }
  310.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  311.   }
  312.  
  313.  
  314.   ; ===============
  315.   ; Set 'Info' vars
  316.   ; ===============
  317.  
  318.   if (%methodd == info) {
  319.     if (<realname> isin %lfmtemp) { set %lfm.realname $remove(%lfmtemp,<realname>,</realname>) }
  320.     if (<country> isin %lfmtemp) { set %lfm.country $remove($gettok(%lfmtemp,1,32),<country>,</country>) }
  321.     if (<name> isin %lfmtemp) { set %lfm.name $remove($gettok(%lfmtemp,1,32),<name>,</name>) }
  322.     if (<age> isin %lfmtemp) { set %lfm.age $remove($gettok(%lfmtemp,1,32),<age>,</age>) }
  323.     if (<id> isin %lfmtemp) { set %lfm.id $remove($gettok(%lfmtemp,1,32),<id>,</id>) }
  324.     if (size="large" isin %lfmtemp) { set %lfm.image $remove($gettok(%lfmtemp,2,32),size="large">,</image>) }
  325.     if (<gender> isin %lfmtemp) { set %lfm.gender $remove($gettok(%lfmtemp,1,32),<gender>,</gender>) }
  326.     if (<playcount> isin %lfmtemp) { set %lfm.plays $remove($gettok(%lfmtemp,1,32),<playcount>,</playcount>) }
  327.     if (<subscriber> isin %lfmtemp) { set %lfm.subscriber $remove(%lfmtemp,<subscriber>,</subscriber>) }
  328.     if (<type> isin %lfmtemp) { set %lfm.type $remove(%lfmtemp,<type>,</type>) }
  329.     set %lfm.url http://last.fm/user/ $+ %username
  330.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  331.   }
  332.  
  333.   ; ==================
  334.   ; Set 'Compare' vars
  335.   ; ==================
  336.  
  337.   if (%methodd == compare) {
  338.     if (<score> isin %lfmtemp) { set %lfm.score $round($calc($nohtml(%lfmtemp)*100),1) }
  339.     if (<name> isin %lfmtemp)  { set %lfm.artists $+(%lfm.artists,$chr(32),$replace($nohtml(%lfmtemp),&amp;,&,&quot;,"),$chr(44)) }
  340.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  341.   }
  342.  
  343.   ; ==================
  344.   ; Set 'Similar' vars
  345.   ; ==================
  346.  
  347.   if (%methodd == similar) {
  348.     if (<name> isin %lfmtemp)  {
  349.       set %lfm.similar $+(%lfm.similar,$chr(32),$nohtml(%lfmtemp),$chr(44))
  350.     }
  351.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  352.   }
  353.  
  354.   ; =======================
  355.   ; Set 'New Releases' vars
  356.   ; =======================
  357.  
  358.   if (%methodd == lfmnr) {
  359.     if ((<name> isin %lfmtemp) && (%lfmnametemp == 0) && (%lfmnrtemp < %lfmnrout)) { set %lfmrecsout %lfmrecsout $replace($nohtml(%lfmtemp),&amp;,&,&quot;,") - }
  360.     if ((<name> isin %lfmtemp) && (%lfmnametemp == 1) && (%lfmnrtemp < %lfmnrout)) {
  361.       set %lfmrecsout %lfmrecsout $replace($nohtml(%lfmtemp),&amp;,&,&quot;,") $+ ,
  362.       set %lfmnametemp 0
  363.       inc %lfmnrtemp
  364.     }    
  365.     if (<artist> isin %lfmtemp) { set %lfmnametemp 1 }
  366.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  367.   }
  368.  
  369.   ; ============================
  370.   ; Set 'Chart Top Artists' vars
  371.   ; ============================
  372.  
  373.   if (%methodd == lfmta) {
  374.     if (<name> isin %lfmtemp) {
  375.       set %lfm.topartists $+(%lfm.topartists,$chr(32),$nohtml(%lfmtemp),$chr(44))
  376.     }
  377.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  378.   }
  379.  
  380.   ; ===========================
  381.   ; Set 'User Top Artists' vars
  382.   ; ===========================
  383.  
  384.   if (%methodd == lfmuta) {
  385.     if (<name> isin %lfmtemp) {
  386.       set %lfm.usertop $+(%lfm.usertop,$chr(32),$nohtml(%lfmtemp),$chr(44))
  387.     }
  388.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  389.   }
  390.  
  391.   ; ========================
  392.   ; Set 'User Neighbor' vars
  393.   ; ========================
  394.  
  395.   if (%methodd == lfmn) {
  396.     if (<name> isin %lfmtemp) {
  397.       set %lfm.neighbors $+(%lfm.neighbors,$chr(32),$nohtml(%lfmtemp),$chr(44))
  398.     }
  399.     if (<error isin %lfmtemp) { var %err $remove(%lfmtemp,<error code=",</lfm>,</error>,">) | $sock(lfm).mark $remove(%err,$left(%err,1))  | unset %lfm.* | sockclose lfm }
  400.   }
  401. }
  402.  
  403. ; ===============================
  404. ; Close socket and message output
  405. ; ===============================
  406.  
  407. on *:sockclose:lfm: {
  408.   if (%methodd == np2) {
  409.     msg %lfm.chan 4Last.fm » %username is playing $qt(%lfmname) by %lfmartist $iif(%lfmalbum,$chr(124) album: %lfmalbum,$null) $chr(124) $iif(%lfm.playcount,$+($chr(40),Played %lfm.playcount times,$chr(41))) $iif(%lfm.loved,4♥) $iif(%lfm.length,$+([,$gettok($duration($calc(%lfm.length / 1000),3),2-,58),]))
  410.     unset %lfm* | unset %lfmcu* | unset %method | unset %methodd
  411.   }
  412.   if (%methodd == np) {
  413.     set %methodd np2
  414.     set %method $+(/2.0/?method=track.getinfo&api_key= $+ $lastAPIKey $+ &artist=,$urlencode(%lfmartist),&track=,$urlencode(%lfmname),&username=,%username)
  415.     if ($sock(lfm)) { sockclose lfm }
  416.     sockopen lfm ws.audioscrobbler.com 80
  417.   }
  418.   if (%methodd == info) {
  419.     $sock(lfm).mark User: %username 4» ID: $iif(%lfm.id == $null,Not Specified,%lfm.id) 4» Subscriber? $replace(%lfm.subscriber,0,No,1,Yes) 4» Type: %lfm.type $+ 
  420.     $sock(lfm).mark Real Name: $iif(%lfm.realname == $null,Not Specified,%lfm.realname) 4» Name: $iif(%lfm.name == $null,Not Specified,%lfm.name) 4» Age: $iif(%lfm.age == $null,Not Specified,%lfm.age) 4» Gender: $iif(%lfm.gender == $null,Not Specified,$replace(%lfm.gender,m,Male,f,Female,n,Unknown)) 4» Country: $iif(%lfm.country == $null,Not Specified,%lfm.country)
  421.     $sock(lfm).mark Plays: %lfm.plays 4» Image: $iif(%lfm.image == $null,Not Specified,%lfm.image) 4» %lfm.url
  422.     unset %lfm* | unset %lfmcu* | unset %method | unset %methodd
  423.   }
  424.   if (%methodd == compare) {
  425.     $sock(lfm).mark %lfmcu1 $+ 's compatibility with %lfmcu2 is $iif(%lfm.score == 0,Unknown.,$compat(%lfm.score) $+($chr(40),%lfm.score,$chr(37),$chr(41),$chr(46)) Artist(s) they have in common include(s) $gettok(%lfm.artists,1- $+ $calc($gettok(%lfm.artists,0,44) - 2),44) $+ .)
  426.     unset %lfm* | unset %lfmcu* | unset %method | unset %methodd
  427.   }
  428.   if (%methodd == similar) {
  429.     $sock(lfm).mark Similar Artists: $replace($gettok(%lfm.similar,1-10,44) $+ .,&amp;,&)
  430.     unset %lfm* | unset %lfmcu* | unset %method | unset %methodd
  431.   }
  432.   if (%methodd == lfmnr) {
  433.     $sock(lfm).mark New Album Releases for %username are: $gettok(%lfmrecsout,1- %%lfmnrout,44) $+ .
  434.     unset %lfm* | unset %method | unset %methodd | unset %username
  435.   }
  436.   if (%methodd == lfmta) {
  437.     $sock(lfm).mark Top of the Last.fm Charts: $gettok(%lfm.topartists,1-10,44) $+ .
  438.     unset %lfm* | unset %method | unset %methodd | unset %username
  439.   }
  440.   if (%methodd == lfmuta) {
  441.     $sock(lfm).mark Top 10 Artists for %username 4» Period: $replace(%period,overall,Overall:,7day,Last 7 Days:,3month,Last 3 Months:,6month,Last 6 Months:,12month,Last 12 months:) $gettok(%lfm.usertop,1-10,44) $+ .
  442.     unset %lfm* | unset %method | unset %methodd | unset %username | unset %period
  443.   }
  444.   if (%methodd == lfmn) {
  445.     $sock(lfm).mark Top 10 Neighbors: $gettok(%lfm.neighbors,1-10,44) $+ . http://www.last.fm/user/ $+ %username $+ /neighbours
  446.     unset %lfm* | unset %method | unset %methodd | unset %username
  447.   }
  448. }
  449.  
  450. alias nohtml {
  451.   var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  452.   return %x
  453. }
  454.  
  455. alias urlencode {
  456.   var %a = $regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
  457.   return $replace(%a,$chr(32),$chr(43))
  458. }
  459.  
  460. alias -l compat {
  461.   if ($1 isnum 00.0-16.6) { return Very Low }
  462.   if ($1 isnum 16.6-33.3) { return Low }
  463.   if ($1 isnum 33.3-50.0) { return Medium }
  464.   if ($1 isnum 50.0-66.6) { return High }
  465.   if ($1 isnum 66.6-83.4) { return Very High }
  466.   if ($1 isnum 83.4-100) { return Super }
  467. }
  468.  
  469. On *:EXIT: {
  470.   hsave lastinfo lastinfo.hsh
  471.   hfree lastinfo
  472. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top