PHP_METHOD(SpotifyPlaylist, getTracks) { zval tempretval, *type, *spotifyobject; ALLOC_INIT_ZVAL(type); Z_TYPE_P(type) = IS_LONG; Z_LVAL_P(type) = 0; spotifyobject = GET_THIS_PROPERTY(spotifyplaylist_ce, "spotify"); object_init_ex(return_value, spotifytrackiterator_ce); SPOTIFY_METHOD3(SpotifyTrackIterator, __construct, &tempretval, return_value, getThis(), type, spotifyobject); }
PHP_METHOD(SpotifyAlbumIterator, offsetGet) { zval *index, temp, *spotifyobject; sp_album *album; spotifyalbumiterator_object *p; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) { return; } p = (spotifyalbumiterator_object*)zend_object_store_get_object(getThis() TSRMLS_CC); album = sp_artistbrowse_album(p->artistbrowse, Z_LVAL_P(index)); spotifyobject = GET_THIS_PROPERTY(spotifyalbumiterator_ce, "spotify"); object_init_ex(return_value, spotifyalbum_ce); SPOTIFY_METHOD2(SpotifyAlbum, __construct, &temp, return_value, spotifyobject, album); }
PHP_METHOD(SpotifyAlbumIterator, current) { spotifyalbumiterator_object *p; sp_album *album; zval temp, *spotifyobject; int timeout; p = (spotifyalbumiterator_object*)zend_object_store_get_object(getThis() TSRMLS_CC); album = sp_artistbrowse_album(p->artistbrowse, p->position); while (!sp_album_is_loaded(album)) { sp_session_process_events(p->session, &timeout); } spotifyobject = GET_THIS_PROPERTY(spotifyalbumiterator_ce, "spotify"); object_init_ex(return_value, spotifyalbum_ce); SPOTIFY_METHOD2(SpotifyAlbum, __construct, &temp, return_value, spotifyobject, album); }