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.
September 27th, 2007 17:54
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
October 13th, 2007 23:44
http://blog.ryara.net/wp-content/uploads/2007/09/npscriptlastfm.pl says 404
October 14th, 2007 03:12
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.
October 16th, 2007 04:31
Yeah, I get the same “not enough parameters” problem as Ozzee
November 15th, 2007 19:23
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 ”
November 15th, 2007 19:30
So wordpress doesn’t like quatation marks?
http://huono.info/npScriptLastFm.pl <<that is working on my server, and there you can see what I was tryin to say on my previous post.
December 10th, 2007 16:42
thx for this script!!!
i took a few changes, for me its much faster.
http://nopaste.info/2d65ee835c.html
December 10th, 2007 21:41
The changes you made does more than speeding it up, you change the functionality as well. The command you provided ( curl –silent http://ws.audioscrobbler.com/1.0/user/$lastfmuser/recenttracks.txt | head -n1 | sed ’s,^………..,,;’ | recode utf-8..iso-8859-1 ) fetches the last song you’ve finished listening to, not the one you’re currently listening to.
December 20th, 2007 16:53
“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.
December 25th, 2007 08:36
@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.
January 1st, 2008 21:31
@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?
September 16th, 2008 17:18
here is my tweaked version. shows artist and track. so if not playing right now, shows the last one played.
creds to the original creator
http://slug.dy.fi/npScriptLastFm.pl
September 16th, 2008 17:42
Instead of using my script (or any modified version of it) I would recommend to use http://soy.se/code/lastfm.pl instead - it has many more features, and uses a better mechanism to fetch the data (Last.fm API instead of screen scraping).