sp_playlist* playlist_get(int nb) { if (nb == 0) { if (g_starred_playlist == NULL) g_starred_playlist = sp_session_starred_create(g_session); return g_starred_playlist; } else return sp_playlistcontainer_playlist(g_container, nb-1); }
static PyObject * Session_starred(PyObject *self) { sp_playlist *playlist; Py_BEGIN_ALLOW_THREADS; playlist = sp_session_starred_create(Session_SP_SESSION(self)); Py_END_ALLOW_THREADS; return Playlist_FromSpotify(playlist, 0 /* add_ref */); }
static PyObject * Session_starred(Session * self) { sp_playlist *spl; Py_BEGIN_ALLOW_THREADS; spl = sp_session_starred_create(self->_session); Py_END_ALLOW_THREADS; PyObject *pl = Playlist_FromSpotify(spl); return pl; }
QSpotifyPlaylist *QSpotifyUser::starredList() const { if (!m_starredList) { sp_playlist *sl; if (QSpotifySession::instance()->user() == this) { sl = sp_session_starred_create(QSpotifySession::instance()->m_sp_session); } else { sl = sp_session_starred_for_user_create(QSpotifySession::instance()->m_sp_session, m_canonicalName.toUtf8().constData()); } m_starredList = new QSpotifyPlaylist(QSpotifyPlaylist::Starred, sl, false); m_starredList->init(); QQmlEngine::setObjectOwnership(m_starredList, QQmlEngine::CppOwnership); } return m_starredList; }
SpotifyPlaylist* SpotifyUser::starredList() { if(m_starredList == nullptr) { sp_playlist* playlist; if(SpotifySession::instance()->user() == this) { playlist = sp_session_starred_create(SpotifySession::instance()->native()); } else { playlist = sp_session_starred_for_user_create(SpotifySession::instance()->native(), m_canonicalName.toUtf8().constData()); } m_starredList = new SpotifyPlaylist(playlist); } return m_starredList; }
PHP_METHOD(Spotify, getStarredPlaylist) { zval *object = getThis(); zval temp; spotify_object *obj = (spotify_object*)zend_object_store_get_object(object TSRMLS_CC); do { sp_session_process_events(obj->session, &obj->timeout); } while (obj->timeout == 0); sp_playlist *playlist = sp_session_starred_create(obj->session); object_init_ex(return_value, spotifyplaylist_ce); SPOTIFY_METHOD2(SpotifyPlaylist, __construct, &temp, return_value, object, playlist); }