Now playing for irssi using Last.fm

You sometimes want announce what music you’re playing on IRC, but when using irssi on a remote server this becomes something of a problem. Therefore I wrote a script for irssi that track info for the currently playing track from last.fm, and prints it to the current channel.

To use the script:
1. Get it and place it in your ~/.irssi/scripts folder.
2. Optionally place a symlink to it in ~/.irssi/scripts/autorun directory to load it automatically when you start irssi.
3. Edit the file and change the $lastfmuser variable to your Last.fm username.
4. Load the script in irssi: /RUN npScriptLastFm.pl
5. You can now use the script by using the command /np

As written in the file itselft it’s distributed under the MIT license.
Hope you’ll find it useful.

Update 2: It is no longer recommended to use this script. See this comment for details and a better alternative.

Update 1: Thanks to Salminen (see comments), the script should now be working, I’ve updated the link so it points to the working version.

13 thoughts on “Now playing for irssi using Last.fm”

  1. Hi, when I run the script I get this in my status window:

    18:51:05 Irssi: Loaded script npScriptLastFm
    18:51:08 Irssi: Not enough parameters given
    18:51:08 Irssi:

    Any idea why?

    Thank You :)

  2. Sorry about that, the link should be working now. However the script seems to be broken, I’ll look over it sometime when I get time for it.

  3. Nice script indeed.

    First I had “not enough parameters” errors, but I got this working on my server by changing
    grep -A 1 “”
    to
    grep -A 1 ”

  4. “Add this track to your playlist” part doesn’t work with “eq” on my computer, changed it to “==” and now it works.
    I don’t know if this feature has something to do with different perl versions.

  5. @Salminen

    Ummm….

    Using == is BAD for strings. Comparing any two strings with == will return true. If you don’t believe me, try perl -e 'print "true\n" if ("Add this track to your playlist" == "hi")'

    That said, if you have the same script I downloaded, changing it to == should NEVER work, but will only print “Nothing playing!” every time you use the command.

  6. @Possum

    My computer says “Add this track to your playlist” to the channel if I use “eq” but with “==” it says what I’m playing and when not playing it echos me “Nothing playing!”.

    So why not use somethind “bad” if it works when the original doesn’t?

Comments are closed.