Source for file Artist.php
Documentation is available at Artist.php
/** Represents an artist and provides different methods to query artist information.
* @package php-lastfm-api
* @author Felix Bruns <felixbruns@web.de>
/** Artist is streamable.
/** The artists biography.
/** Stores a similarity value.
/** Create an Artist object.
* @param string $name Name of this artist.
* @param string $mbid MusicBrainz ID of this artist.
* @param string $url Last.fm URL of this artist.
* @param array $images An array of cover art images of different sizes.
* @param boolean $streamable Is this artist streamable?
* @param integer $listeners Number of listeners of this artist.
* @param integer $playCount Play count of this artist.
* @param array $tags An array of tags of this artist.
* @param array $similar An array of similar artists.
* @param string $biography Biography of this artist.
* @param float $match Similarity value.
public function __construct($name, $mbid, $url, array $images, $streamable,
$listeners, $playCount, array $tags,
array $similar, $biography, $match){
parent::__construct($name, $mbid, $url, $images, $listeners, $playCount);
$this->streamable =
$streamable;
$this->similar =
$similar;
$this->biography =
$biography;
/** Returns if this artists is streamable.
* @return boolean true if this artist is streamable, otherwise false.
return $this->streamable;
/** Returns similar artists.
* @return array An array of similar artists.
* @return array An array of Tag objects.
/** Returns the artists biography.
* @return string A biography text.
/** Returns similarity value.
* @return float A floating-point value from 0.0 to 1.0.
/** Tag an artist with one or more user supplied tags.
* @param string $artist The artist name in question. (Required)
* @param array $tags An array of user supplied tags to apply to this artist. Accepts a maximum of 10 tags. (Required)
* @param Session $session A session obtained by {@link de.felixbruns.lastfm.Auth#getSession Auth::getSession} or {@link de.felixbruns.lastfm.Auth#getMobileSession Auth::getMobileSession}. (Required)
public static function addTags($artist, array $tags, Session $session){
CallerFactory::getDefaultCaller()->signedCall('artist.addTags', array(
'tags' =>
implode(',', $tags)
/** Get a list of upcoming events for this artist. Easily integratable into calendars, using the ical standard (see feeds section below).
* @param string $artist The artist name in question. (Required)
* @return array An array of Event objects.
foreach($xml->children() as $event){
/** Get the metadata for an artist on last.fm. Includes biography.
* @param string $artist The artist name in question. (Optional)
* @param string $mbid The MusicBrainz ID for the artist. (Optional)
* @param string $lang The language to return the biography in, expressed as an ISO 639 alpha-2 code. (Optional)
* @return Artist An Artist object.
public static function getInfo($artist, $mbid =
null, $lang =
null){
/** Get shouts for this artist.
* @param string $artist The artist name in question. (Required)
* @return array An array of Shout objects.
foreach($xml->children() as $shout){
/** Get all the artists similar to this artist.
* @param string $artist The artist name in question. (Required)
* @param string $limit Limit the number of similar artists returned. (Optional)
* @return array An array of Artist objects.
public static function getSimilar($artist, $limit =
null){
foreach($xml->children() as $artist){
/** Get the tags applied by an individual user to an artist on last.fm.
* @param string $artist The artist name in question. (Required)
* @param Session $session A session obtained by {@link de.felixbruns.lastfm.Auth#getSession Auth::getSession} or {@link de.felixbruns.lastfm.Auth#getMobileSession Auth::getMobileSession}. (Required)
* @return array An array of tags.
public static function getTags($artist, Session $session){
foreach($xml->children() as $tag){
/** Get the top albums for an artist on last.fm, ordered by popularity.
* @param string $artist The artist name in question. (Required)
* @return array An array of Album objects.
foreach($xml->children() as $album){
/** Get the top fans for an artist on last.fm, based on listening data.
* @param string $artist The artist name in question. (Required)
* @return array An array of User objects.
foreach($xml->children() as $fan){
/** Get the top tags for an artist on last.fm, ordered by popularity.
* @param string $artist The artist name in question. (Required)
* @return array An array of Tag objects.
foreach($xml->children() as $tag){
/** Get the top tracks by an artist on last.fm, ordered by popularity.
* @param string $artist The artist name in question. (Required)
* @return array An array of Track objects.
foreach($xml->children() as $track){
/** Remove a user's tag from an artist.
* @param string $artist The artist name in question. (Required)
* @param string $tag A single user tag to remove from this artist. (Required)
* @param Session $session A session obtained by {@link de.felixbruns.lastfm.Auth#getSession Auth::getSession} or {@link de.felixbruns.lastfm.Auth#getMobileSession Auth::getMobileSession}. (Required)
public static function removeTag($artist, $tag, Session $session){
/** Search for an artist by name. Returns artist matches sorted by relevance.
* @param string $artist The artist name in question. (Required)
* @param integer $limit Limit the number of artists returned at one time. Default (maximum) is 30. (Optional)
* @param integer $page Scan into the results by specifying a page number. Defaults to first page. (Optional)
* @return PaginatedResult A PaginatedResult object.
public static function search($artist, $limit =
null, $page =
null){
foreach($xml->artistmatches->children() as $artist){
$opensearch =
$xml->children('http://a9.com/-/spec/opensearch/1.1/');
/** Share an artist with last.fm users or other friends.
* @param string $artist The artist to share. (Required)
* @param array $recipients An array email addresses or last.fm usernames. Maximum is 10. (Required)
* @param string $message An optional message to send with the recommendation. If not supplied a default message will be used. (Optional)
* @param Session $session A session obtained by {@link de.felixbruns.lastfm.Auth#getSession Auth::getSession} or {@link de.felixbruns.lastfm.Auth#getMobileSession Auth::getMobileSession}. (Required)
public static function share($artist, array $recipients, $message =
null, Session $session){
CallerFactory::getDefaultCaller()->signedCall('artist.share', array(
'recipient' =>
implode(',', $recipients),
/** Get an artist playlist for streaming. INOFFICIAL.
* @param string $artist Artist name.
* @return Playlist A Playlist object.
/** Create an Artist object from a SimpleXMLElement object.
* @param SimpleXMLElement $xml A SimpleXMLElement object.
* @return Artist An Artist object.
/* NOTE: image, image_small... this sucks! */
if(count($xml->image) >
1){
foreach($xml->image as $image){
foreach($xml->tags->children() as $tag){
foreach($xml->similar->children() as $artist){
($xml->bio)?
Util::toString($xml->bio->summary):
"", // TODO: Biography object
Documentation generated on Mon, 22 Dec 2008 16:57:30 +0100 by phpDocumentor 1.4.1