PHP 클래스 App\services\Lastfm

상속: extends RESTfulService
파일 보기 프로젝트 열기: phanan/koel 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$keyParam string Override the key param, since, again, Lastfm wants to be different.
$responseFormat string Specify the response format, since Last.fm only returns XML.

공개 메소드들

메소드 설명
__construct ( string $key = null, string $secret = null, Client $client = null ) Construct an instance of Lastfm service.
buildAuthCallParams ( array $params, boolean $toString = false ) : array | string Build the parameters to use for _authenticated_ Last.fm API calls.
enabled ( ) : boolean Determine if Last.fm integration is enabled.
getAlbumInfo ( string $name, string $artistName ) : array | false Get information about an album.
getArtistInfo ( $name ) : array | false Get information about an artist.
getSessionKey ( string $token ) : string Get Last.fm's session key for the authenticated user using a token.
scrobble ( string $artist, string $track, string | integer $timestamp, string $album, string $sk ) : boolean Scrobble a song.
toggleLoveTrack ( string $track, string $artist, string $sk, boolean $love = true ) : boolean Love or unlove a track on Last.fm.
updateNowPlaying ( string $artist, string $track, string $album, integer | float $duration, string $sk ) : boolean Update a track's "now playing" on Last.fm.
used ( ) : boolean Determine if our application is using Last.fm.

보호된 메소드들

메소드 설명
formatText ( string $str ) : string Correctly format a string returned by Last.fm.

메소드 상세

__construct() 공개 메소드

Construct an instance of Lastfm service.
public __construct ( string $key = null, string $secret = null, Client $client = null )
$key string Last.fm API key.
$secret string Last.fm API shared secret.
$client GuzzleHttp\Client The Guzzle HTTP client.

buildAuthCallParams() 공개 메소드

Such calls require: - The API key (api_key) - The API signature (api_sig).
public buildAuthCallParams ( array $params, boolean $toString = false ) : array | string
$params array The array of parameters.
$toString boolean Whether to turn the array into a query string
리턴 array | string

enabled() 공개 메소드

Determine if Last.fm integration is enabled.
public enabled ( ) : boolean
리턴 boolean

formatText() 보호된 메소드

Correctly format a string returned by Last.fm.
protected formatText ( string $str ) : string
$str string
리턴 string

getAlbumInfo() 공개 메소드

Get information about an album.
public getAlbumInfo ( string $name, string $artistName ) : array | false
$name string Name of the album
$artistName string Name of the artist
리턴 array | false

getArtistInfo() 공개 메소드

Get information about an artist.
public getArtistInfo ( $name ) : array | false
$name string Name of the artist
리턴 array | false

getSessionKey() 공개 메소드

Get Last.fm's session key for the authenticated user using a token.
public getSessionKey ( string $token ) : string
$token string The token after successfully connecting to Last.fm
리턴 string The token key

scrobble() 공개 메소드

Scrobble a song.
public scrobble ( string $artist, string $track, string | integer $timestamp, string $album, string $sk ) : boolean
$artist string The artist name
$track string The track name
$timestamp string | integer The UNIX timestamp
$album string The album name
$sk string The session key
리턴 boolean

toggleLoveTrack() 공개 메소드

Love or unlove a track on Last.fm.
public toggleLoveTrack ( string $track, string $artist, string $sk, boolean $love = true ) : boolean
$track string The track name
$artist string The artist's name
$sk string The session key
$love boolean Whether to love or unlove. Such cheesy terms... urrgggh
리턴 boolean

updateNowPlaying() 공개 메소드

Update a track's "now playing" on Last.fm.
public updateNowPlaying ( string $artist, string $track, string $album, integer | float $duration, string $sk ) : boolean
$artist string Name of the artist
$track string Name of the track
$album string Name of the album
$duration integer | float Duration of the track, in seconds
$sk string The session key
리턴 boolean

used() 공개 메소드

Determine if our application is using Last.fm.
public used ( ) : boolean
리턴 boolean

프로퍼티 상세

$keyParam 보호되어 있는 프로퍼티

Override the key param, since, again, Lastfm wants to be different.
protected string $keyParam
리턴 string

$responseFormat 보호되어 있는 프로퍼티

Specify the response format, since Last.fm only returns XML.
protected string $responseFormat
리턴 string