• Home
  • Servers
  • Chat
  • Channels
  • Commands
  • Forum
  • FAQ
  • Software
  • Quotes
Topic Options
Rate This Topic
#5892 - 10/07/09 11:29 AM Last.Fm Now playing script for mIRC
iAlex Offline
Over 100 posts

Registered: 09/01/08
Posts: 100
Loc: Kongsvinger, 2209 Norway.
I have many scripts like this made by me on my site ialex.info - but I thought I'd throw this one out here as services like spotify is increasing in popularity and people want to use it..

This script displays you're current last.fm in a /me. You can make this show what you're playing spotify by enabling upload to last.fm in spotify settings..

Code:
#Created by Alex Sorlie. you may not remove this stamp if you republish the script.
on *:LOAD:{
  /lastfm $$?="Enter your last.fm username."
  echo Loaded last.fm script by Alex Sorlie
}
alias F3 { np }
alias np {
  if ($sock(lastfm)) .sockclose lastfm
  if (%last.fm.username) {
    sockopen lastfm www.last.fm 80
    set -u10 %last.fm.active $active
  }
  else echo $active Error, no username found.  To set your username use /lastfm <username>
}

alias lastfm { set %last.fm.username $1 }

on *:SOCKOPEN:lastfm: {
  sockwrite -nt $sockname GET /user/ $+ %last.fm.username HTTP/1.1
  sockwrite -nt $sockname Host: www.last.fm
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:lastfm: {
  var %last.fm
  sockread %last.fm
  if (imageMedium isin %last.fm) {
    sockread %last.fm | sockread %last.fm | sockread %last.fm 
    describe %last.fm.active is listening to:04 $replace($regsubex(%last.fm,/(?:<(?:.*?)>)([^<]+)(?:<(?:.*?)>)(?:[^<]+)(?:<(?:.*?)>)([^<]+).+/,\2 by09 \1) 06:: Spotify - A world of music ::,&amp;,&)
    sockclose lastfm
  }
  elseif (</body> isin %last.fm) describe $chan has not configured correctly therefor I cannot show a song.
}
_________________________
http://ialex.info
ialex94wr@gmail.com
alex@ialex.info

Top
Sponsored Links
Sponsored Links
Member
*****

Registered: 27/08/04
Posts: 10136
Loc: Mountain View, CA
Top
#5949 - 10/24/09 02:39 PM Re: Last.Fm Now playing script for mIRC [Re: iAlex]
FordLawnmower Offline
Over 100 posts

Registered: 02/15/09
Posts: 111
Loc: Ohio
Hey iAlex, Long time smile
Nice Post & good Idea smile

I was just wondering what this section of code was for.
Code:
sockread %last.fm | sockread %last.fm | sockread %last.fm 


I couldn't test it because I don't have a lastfm account, but I'm guessing that the script will work the same without it.

Perhaps you could shed some light on this.
At least I posted a comment :P
That's why I stopped posting here. No Comments!
_________________________
If you already know everything, You can never learn anything :P

Top


Moderator:  Jeff, mandy, usrbingeek