Exemplo n.º 1
0
 def as_playlist(self):
     """Make a :class:`Playlist` from the link."""
     if self.type is not LinkType.PLAYLIST:
         return None
     sp_playlist = lib.sp_playlist_create(
         spotify.session_instance._sp_session, self._sp_link)
     if sp_playlist == ffi.NULL:
         return None
     return spotify.Playlist._cached(sp_playlist, add_ref=False)
Exemplo n.º 2
0
 def as_playlist(self):
     """Make a :class:`Playlist` from the link."""
     if self.type is not LinkType.PLAYLIST:
         return None
     sp_playlist = lib.sp_playlist_create(
         self._session._sp_session, self._sp_link)
     if sp_playlist == ffi.NULL:
         return None
     return spotify.Playlist._cached(
         self._session, sp_playlist, add_ref=False)
Exemplo n.º 3
0
 def as_playlist(self):
     """Make a :class:`Playlist` from the link."""
     if self.type not in (LinkType.PLAYLIST, LinkType.STARRED):
         return None
     sp_playlist = lib.sp_playlist_create(self._session._sp_session,
                                          self._sp_link)
     if sp_playlist == ffi.NULL:
         return None
     return spotify.Playlist._cached(self._session,
                                     sp_playlist,
                                     add_ref=False)
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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