src/lastfmapi/Api/UserApi.php
public function getPlaylists($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.getplaylists',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->playlists->playlist) > 0) {
                    $i = 0;
                    foreach ($call->playlists->playlist as $playlist) {
                        $playlists[$i]['id'] = (string) $playlist->id;
                        $playlists[$i]['title'] = (string) $playlist->title;
                        $playlists[$i]['date'] = strtotime(trim((string) $playlist->date));
                        $playlists[$i]['size'] = (string) $playlist->size;
                        $playlists[$i]['streamalbe'] = (string) $playlist->streamable;
                        $playlists[$i]['creator'] = (string) $playlist->creator;
                        $i++;
                    }

                    return $playlists;
                } else {
                    throw new NoResultsException('This user has no past events');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getPlaylists($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.getplaylists',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->playlists->playlist) > 0) {
                    $i = 0;
                    foreach ($call->playlists->playlist as $playlist) {
                        $playlists[$i]['id'] = (string) $playlist->id;
                        $playlists[$i]['title'] = (string) $playlist->title;
                        $playlists[$i]['date'] = strtotime(trim((string) $playlist->date));
                        $playlists[$i]['size'] = (string) $playlist->size;
                        $playlists[$i]['streamalbe'] = (string) $playlist->streamable;
                        $playlists[$i]['creator'] = (string) $playlist->creator;
                        $i++;
                    }

                    return $playlists;
                } else {
                    throw new NoResultsException('This user has no past events');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getPlaylists ( $ methodVars ) { // Check for required variables
 if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getplaylists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> playlists -> playlist ) > 0 ) { $ i = 0 ; foreach ( $ call -> playlists -> playlist as $ playlist ) { $ playlists [ $ i ] [ 'id' ] = ( string ) $ playlist -> id ; $ playlists [ $ i ] [ 'title' ] = ( string ) $ playlist -> title ; $ playlists [ $ i ] [ 'date' ] = strtotime ( trim ( ( string ) $ playlist -> date ) ) ; $ playlists [ $ i ] [ 'size' ] = ( string ) $ playlist -> size ; $ playlists [ $ i ] [ 'streamalbe' ] = ( string ) $ playlist -> streamable ; $ playlists [ $ i ] [ 'creator' ] = ( string ) $ playlist -> creator ; $ i ++ ; } return $ playlists ; } else { throw new NoResultsException ( 'This user has no past events' ) ; } } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist variable in the call for this method' ) ; } }
Get a list of a user's playlists on Last.fm
@deprecated as of march 15 2016, 'user.getplaylists' method is not available
@param array $methodVars An array with the following required values: <i>user</i>
@return array
Get a list of a user s playlists on Last . fm