def get_starred(self, canonical_username=None): """Get the starred :class:`Playlist` for the user with ``canonical_username``. .. warning:: The playlists API was broken at 2018-05-24 by a server-side change made by Spotify. The functionality was never restored. Please use the Spotify Web API to work with playlists. If ``canonical_username`` isn't specified, the starred playlist for the currently logged in user is returned. """ warnings.warn("Spotify broke the libspotify playlists API 2018-05-24 " "and never restored it. " "Please use the Spotify Web API to work with playlists.") if canonical_username is None: sp_playlist = lib.sp_session_starred_create(self._sp_session) else: sp_playlist = lib.sp_session_starred_for_user_create( self._sp_session, utils.to_bytes(canonical_username)) if sp_playlist == ffi.NULL: return None return spotify.Playlist._cached(self, sp_playlist, add_ref=False)
def starred_for_user(self, canonical_username): """The starred :class:`Playlist` for the user with ``canonical_username``.""" sp_playlist = lib.sp_session_starred_for_user_create( self._sp_session, utils.to_bytes(canonical_username)) if sp_playlist == ffi.NULL: return None return spotify.Playlist._cached(sp_playlist, add_ref=False)
def _as_sp_playlist(self): sp_playlist = None if self.type == LinkType.PLAYLIST: sp_playlist = lib.sp_playlist_create(self._session._sp_session, self._sp_link) elif self.type == LinkType.STARRED: matches = re.match(r'^spotify:user:([^:]+):starred$', self.uri) if matches: username = matches.group(1) sp_playlist = lib.sp_session_starred_for_user_create( self._session._sp_session, utils.to_bytes(username)) if sp_playlist is None or sp_playlist == ffi.NULL: return None return sp_playlist
def _as_sp_playlist(self): sp_playlist = None if self.type == LinkType.PLAYLIST: sp_playlist = lib.sp_playlist_create( self._session._sp_session, self._sp_link) elif self.type == LinkType.STARRED: matches = re.match(r'^spotify:user:([^:]+):starred$', self.uri) if matches: username = matches.group(1) sp_playlist = lib.sp_session_starred_for_user_create( self._session._sp_session, utils.to_bytes(username)) if sp_playlist is None or sp_playlist == ffi.NULL: return None return sp_playlist
def get_starred(self, canonical_username=None): """Get the starred :class:`Playlist` for the user with ``canonical_username``. If ``canonical_username`` isn't specified, the starred playlist for the currently logged in user is returned. """ if canonical_username is None: sp_playlist = lib.sp_session_starred_create(self._sp_session) else: sp_playlist = lib.sp_session_starred_for_user_create( self._sp_session, utils.to_bytes(canonical_username)) if sp_playlist == ffi.NULL: return None return spotify.Playlist._cached(self, sp_playlist, add_ref=False)