/** Fetch XSPF playlists using a last.fm playlist url. * * @param string $playlist A lastfm protocol playlist url ('lastfm://playlist/...'). (Required) * @param string $streaming Weather to fetch a playlist for streaming. (Optional) * @param string $fod Weather to fetch a playlist with free on demand tracks. (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}. (Optional) * @return Playlist A Playlist object. * * @static * @access public * @throws Error */ public static function fetch($playlist, $streaming = null, $fod = null, $session = null) { if ($session == null) { $xml = CallerFactory::getDefaultCaller()->call('playlist.fetch', array_filter(array('playlistURL' => $playlist, 'streaming' => $streaming, 'fod' => $fod))); } else { $xml = CallerFactory::getDefaultCaller()->call('playlist.fetch', array_filter(array('playlistURL' => $playlist, 'streaming' => $streaming, 'fod' => $fod, 'sk' => $session->getKey()))); } return Playlist::fromSimpleXMLElement($xml); }
/** Get a list of a user's playlists on last.fm. * * @param string $user The last.fm username to fetch the playlists of. (Required) * @return array An array of Playlist objects. * * @static * @access public * @throws Error */ public static function getPlaylists($user) { $xml = CallerFactory::getDefaultCaller()->call('user.getPlaylists', array('user' => $user)); $playlists = array(); foreach ($xml->children() as $playlist) { $playlists[] = Playlist::fromSimpleXMLElement($playlist); } return $playlists; }
/** * Get a list of a radio's playlists on last.fm. * * @param string $session sk (Required) : A session key generated by authenticating a user via the authentication protocol. * @param float $speed_multiplier speed_multiplier (Optional) : The rate at which to provide the stream (supported multipliers are 1.0 and 2.0) * @param int $bitrate bitrate (Optional) : What bitrate to stream content at, in kbps (supported bitrates are 64 and 128) * @param bool $discovery discovery (Optional) : Whether to request last.fm content with discovery mode switched on. * @param bool $rtp rtp (Optional) : Whether the user is scrobbling or not during this radio session (helps content generation) * * @static * @access public * @throws Error * * @return Playlist * */ public static function getPlaylists(Session $session, $speed_multiplier = null, $bitrate = null, $discovery = null, $rtp = null) { $xml = CallerFactory::getDefaultCaller()->signedCall('radio.getPlaylist', array('discovery' => $discovery, 'rtp' => $rtp, 'speed_multiplier' => $speed_multiplier, 'bitrate' => $bitrate), $session); return Playlist::fromSimpleXMLElement($xml); }