Part of the EllisLab Network
   
 
Last.FM Library
Posted: 14 June 2008 12:02 PM   [ Ignore ]  
Summer Student
Total Posts:  3
Joined  06-14-2008

Hi.

I have written a simple last.fm 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.

Controller:

$this->load->library('lastfm');


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

View:

print_r($lastfm); 

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

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

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.

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

Profile
 
 
Posted: 15 June 2008 06:31 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  3
Joined  06-14-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

TODO
-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.

Cheers,
Dirk

Profile
 
 
Posted: 08 July 2008 04:14 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  135
Joined  06-25-2008

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

 Signature 

Blog | Twitter | Last.fm
MY_Form_Validation - extended for protection using nonce words

Profile
 
 
Posted: 08 July 2008 08:16 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  3
Joined  06-14-2008

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

Profile
 
 
Posted: 18 August 2008 10:06 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  16
Joined  06-10-2008
essdeesee - 14 June 2008 04:02 PM

thx, all works. But albums rss not avialable more.

Profile
 
 
Posted: 19 August 2008 09:46 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  16
Joined  06-10-2008

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

Profile
 
 
Posted: 17 March 2011 07:08 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  26
Joined  07-08-2006

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

Profile
 
 
Posted: 07 August 2011 01:02 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  2
Joined  08-07-2011

For reference, archive.org saves the day:

http://web.archive.org/web/20081018191830/http://recoilme.ru/index.php/blog/comments/208

Profile