diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-04 01:31:58 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-04 01:31:58 +0000 |
commit | 848a1bc5388301e128cb5c2c4d8dcb5d06721bb4 (patch) | |
tree | 55a165892eb2bfb486d3120ac376da0321413c35 /lib/class/album.class.php | |
parent | 3851c073e5b51059e60de5d79b78064c53075c04 (diff) | |
download | ampache-848a1bc5388301e128cb5c2c4d8dcb5d06721bb4.tar.gz ampache-848a1bc5388301e128cb5c2c4d8dcb5d06721bb4.tar.bz2 ampache-848a1bc5388301e128cb5c2c4d8dcb5d06721bb4.zip |
fixed lastfm gather album art and add
Diffstat (limited to 'lib/class/album.class.php')
-rw-r--r-- | lib/class/album.class.php | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php index ec1e819b..d801c518 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -260,11 +260,10 @@ class Album { $data = $this->{$method_name}($options['keyword'],$limit); break; case 'get_id3_art': - if ($options['skip_id3']) { break; } $data = $this->{$method_name}($limit); break; default: - $data = $this->{$method_name}(); + $data = $this->{$method_name}($limit); break; } @@ -284,6 +283,36 @@ class Album { } // find_art + /** + * get_lastfm_art + * This returns the art as pulled from lastFM. This doesn't require + * a special account, we just parse and run with it. + */ + public function get_lastfm_art($limit) { + + // Create the parser object + $lastfm = new LastFMSearch(); + + $raw_data = $lastfm->search($this->artist_name,$this->name); + + if (!count($raw_data)) { return array(); } + + $coverart = $raw_data['coverart']; + + ksort($coverart); + foreach ($coverart as $key=>$value) { + $i++; + $url = $coverart[$key]; + $results = pathinfo($url); + $mime = 'image/' . $results['extension']; + $data[] = array('url'=>$url,'mime'=>$mime); + if ($i >= $limit) { return $data; } + } // end foreach + + return $data; + + } // get_lastfm_art + /*! @function get_id3_art @discussion looks for art from the id3 tags |