Last.fm Plugin

Creating and modifying plugins.
Post Reply
echox
Posts: 3
Joined: Sun Jan 07, 2007 11:36 pm
Contact:

Last.fm Plugin

Post by echox »

I've created a small plugin to show the latest songs from last.fm because I wasn't able to get audioscruggler to work :)

Just enter your last.fm username, the count of songs to show and if you want to see the timestamp when you heard it.

The code is not ver pretty but it works fine and will also work when allow_fopen is off for security reasons.

Just extract http://www.echox.de/downloads/lastfm_pl ... 1.0.tar.gz to your plugins directory and add it to your sidebar.

Suggestions are welcome and I hope this kind of posting is ok here.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Exactly the right place. Good job! I'm sure it'll be added to the repository soon.
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Great work, would you like me to add your plugin to spartacus?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
echox
Posts: 3
Joined: Sun Jan 07, 2007 11:36 pm
Contact:

Post by echox »

garvinhicking wrote:Hi!

Great work, would you like me to add your plugin to spartacus?

Best regards,
Garvin
If this is possible, it would be wonderfull :D
thx for the feedback
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Guys, isn't this what the already existing Audioscrobbler plugin does? Audioscrobbler had been acquired by last.fm quite some time ago, and AFAIK last.fm now offers all the Audioscrobbler services. Please check with the author of the audioscrobbler plugin, Flo, before you add this to spartacus
echox
Posts: 3
Joined: Sun Jan 07, 2007 11:36 pm
Contact:

Post by echox »

Ok, I didn't really realize the connection between Audioscrobbler and Last.fm, this is because I just quickly tested audioscrobbler and could see that it doesn't work and then quickly wrote this plugin.
I thought the existing audioscrobbler plugin doesn't work because as was bought by last.fm, etc.

Now I had a look on the source and this looks like a small php problem, nothing else. I just did a quick and dirty fix (removed call of reencode because I use utf-8) and it works without any problem, does the same thing like my plugin does but a little bit smarter (cache, nice xml parsing, etc.).

I really can't figure out whats the exact problem with the audiscrobbler plugin but I think the author should be able to quickly fix it.
DevilDawn
Posts: 1
Joined: Tue Jan 16, 2007 9:01 am

Post by DevilDawn »

echox wrote:I really can't figure out whats the exact problem with the audiscrobbler plugin but I think the author should be able to quickly fix it.
It seems the plugin calls the "reencode" method without "$this->". I made it work for me by simply changing these lines:
grep -n '$this->reencode' serendipity_plugin_audioscrobbler.php wrote: 251: $songs[$counter]['link'] = $this->reencode($xml['value']);
255: $songs[$counter]['songtitle'] = $this->reencode($xml['value']);
259: $songs[$counter]['date'] = $this->reencode($xml['attributes']['UTS']);
263: $songs[$counter]['songlink'] = trim($this->reencode($xml['value']));
268: $songs[$counter]['artisttitle'] = $this->reencode($xml['value']);
273: $songs[$counter]['description'] = $this->reencode($xml['value']);
275: $songs[$counter]['date'] = $this->reencode($xml['value']);
277: $songs[$counter]['songtitle'] = $this->reencode($xml['value']);
280: $songs[$counter]['artistlink'] = $this->reencode($xml['attributes']['RDF:ABOUT']);
282: $songs[$counter]['artisttitle'] = $this->reencode($xml['value']);
285: $songs[$counter]['albumtitle'] = $this->reencode($xml['value']);
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Thanks a lot, DevilDawn, I committed your fix!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
k1x
Posts: 1
Joined: Thu Feb 22, 2007 7:59 pm

Post by k1x »

Hi,

I'm using the last.fm plugin and it's a very good plugin!!!! :P

But I've a problem regarding the caching of the songs. so that every day after not hearing songs for some hours - the list is again empty. Due to the fact that the plugin gets the songs from a file on audioscrobbler - i think the saved history is deleted in anyway during the night.

Is there a possibility to let the songs in the list also when they are some days old (when i'm not hearing music on my computer)?
Post Reply