本文整理汇总了PHP中Playlist::fromSimpleXMLElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Playlist::fromSimpleXMLElement方法的具体用法?PHP Playlist::fromSimpleXMLElement怎么用?PHP Playlist::fromSimpleXMLElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::fromSimpleXMLElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/** 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);
}
示例2: getPlaylists
/** 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;
}
示例3: getPlaylists
/**
* 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);
}