platypush/plugins/music/spotify/__init__.py
def add_to_playlist(self, playlist: str, resources: Union[str, Iterable[str]], position: Optional[int] = None):
        """
        Add one or more items to a playlist.

        :param playlist: Playlist name, ID or URI.
        :param resources: URI(s) of the resource(s) to be added.
        :param position: At what (1-based) position the tracks should be inserted (default: append to the end).
        """
        playlist = self._get_playlist(playlist)
        response = self.spotify_user_call(
            f'/v1/playlists/{playlist["id"]}/tracks',
            method='post',
            params={
                **({'position': position} if position is not None else {}),
            },
            json={
                'uris': [
                    uri.strip() for uri in (
                        resources.split(',') if isinstance(resources, str) else resources
                    )
                ]
            }
        )

        snapshot_id = response.get('snapshot_id')
        assert snapshot_id is not None, 'Could not save playlist'

        Add one or more items to a playlist.

        :param playlist: Playlist name, ID or URI.
        :param resources: URI(s) of the resource(s) to be added.
        :param position: At what (1-based) position the tracks should be inserted (default: append to the end).
        
Add one or more items to a playlist.
Add one or more items to a playlist .
def add_to_playlist(self, playlist: str, resources: Union[str, Iterable[str]], position: Optional[int] = None):
        playlist = self._get_playlist(playlist)
        response = self.spotify_user_call(
            f'/v1/playlists/{playlist["id"]}/tracks',
            method='post',
            params={
                **({'position': position} if position is not None else {}),
            },
            json={
                'uris': [
                    uri.strip() for uri in (
                        resources.split(',') if isinstance(resources, str) else resources
                    )
                ]
            }
        )
        snapshot_id = response.get('snapshot_id')
        assert snapshot_id is not None, 'Could not save playlist'
def add_to_playlist ( self , playlist : str , resources : Union [ str , Iterable [ str ] ] , position : Optional [ int ] = None ) : playlist = self . _get_playlist ( playlist ) response = self . spotify_user_call ( f'/v1/playlists/{playlist["id"]}/tracks' , method = 'post' , params = { ** ( { 'position' : position } if position is not None else { } ) , } , json = { 'uris' : [ uri . strip ( ) for uri in ( resources . split ( ',' ) if isinstance ( resources , str ) else resources ) ] } ) snapshot_id = response . get ( 'snapshot_id' ) assert snapshot_id is not None , 'Could not save playlist'
Add one or more items to a playlist.
Add one or more items to a playlist .
"""
        Add one or more items to a playlist.

        :param playlist: Playlist name, ID or URI.
        :param resources: URI(s) of the resource(s) to be added.
        :param position: At what (1-based) position the tracks should be inserted (default: append to the end).
        """
self
playlist
str
Playlist name, ID or URI.
Playlist name ID or URI .
resources
Union[str, Iterable[str]]
URI(s) of the resource(s) to be added.
URI ( s ) of the resource ( s ) to be added .
position
Optional[int]
At what (1-based) position the tracks should be inserted (default: append to the end).
At what ( 1 - based ) position the tracks should be inserted ( default : append to the end ) .