CodeIgniter Forums
Last.FM Library - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Libraries & Helpers (
+--- Thread: Last.FM Library (/showthread.php?tid=9153)

Last.FM Library - El Forum - 06-14-2008


I have written a simple library (PHP 5 only...maybe for now)

It will just make the process of grabbing the data for different feeds a bit easier for you.

Usage is simple.


$config = array('user' => 'lastFMName', ‘feed’ => ‘topalbums’, ’start’ => 0, ‘amount’ => 6);
$data['lastfm'] = $this->lastfm->getData();


Of course, you can then do whatever you want with that data. For example, my top albums output looks like.

foreach ($lastfm as $album)
           <a href="&lt;?=$album['url']?&gt;" title="#&lt;?=$album['rank']?&gt; . &lt;?=$album['artist']?&gt; - &lt;?=$album['name']?&gt;">
              <img src="&lt;?=$album['image']['medium']?&gt;"/>

You can get the library Here, the returns and feed types are defined at the top of the file.

Honestly, the whole idea of me even putting this up is to save someone elses time. I hope it does.

-Image Caching
-PHP 4 Support (Maybe)
-Feed Caching?

Last.FM Library - El Forum - 06-15-2008

Version 0.2
-Added Caching of Feeds and Images
-Cleared up some random variables that I left lying around when I abstracted it further

-Clear up cache folder after a time has elapsed.
-Write documentation that doesn't suck

Just make sure you update the attributes in the init method, or maybe the world will explode vOv, really though when you're calling the method all attributes are optional, they will just default to my original needs.

I probably want to test it a lot more thoroughly now also, I'm using this for 2 users, so I wrote it in a fashion that creates a folder for each user, then dumps their feeds, images, souls etc in there.

Just to let you know, my page load time went from 3.8 Seconds to 0.5 Seconds (top albums + 6 images) when I sorted out the caching.


Last.FM Library - El Forum - 07-08-2008

Looking good! Any progress on this project? I love and really like the idea of easy CI implementation. I'll probably use this on the site I'm currently working on. Thanks!

Last.FM Library - El Forum - 07-08-2008

I've been slowly fixing up the documentation. I'll put up the new version over the weekend.

Last.FM Library - El Forum - 08-18-2008

[quote author="essdeesee" date="1213477340"]
thx, all works. But albums rss not avialable more.

Last.FM Library - El Forum - 08-19-2008

Little improvements for CodeIgniter Lastfm Library No double upload for artists images.

Last.FM Library - El Forum - 03-17-2011

Are either of these libraries still available? Both of your links no longer work.

Last.FM Library - El Forum - 08-07-2011

For reference, saves the day: