platypush/plugins/music/spotify/__init__.py
def playlist_move(self, playlist: str, from_pos: int, to_pos: int, range_length: int = 1,
                      resources: Optional[Union[str, Iterable[str]]] = None, **_):
        """
        Move or replace elements in a playlist.

        :param playlist: Playlist name, ID or URI.
        :param from_pos: Move tracks starting from this position (the first element has index 1).
        :param to_pos: Move tracks to this position (1-based index).
        :param range_length: Number of tracks to move (default: 1).
        :param resources: If specified, then replace the items from `from_pos` to `from_pos+range_length` with the
            specified set of Spotify URIs (it must be a collection with the same length as the range).
        """
        playlist = self._get_playlist(playlist)
        response = self.spotify_user_call(
            f'/v1/playlists/{playlist["id"]}/tracks',
            method='put',
            json={
                'range_start': int(from_pos) + 1,
                'range_length': int(range_length),
                'insert_before': int(to_pos) + 1,
                **({'uris': [
                    uri.strip() for uri in (
                        resources.split(',') if isinstance(resources, str) else resources
                    )
                ]} if resources else {})
            }
        )

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

        Move or replace elements in a playlist.

        :param playlist: Playlist name, ID or URI.
        :param from_pos: Move tracks starting from this position (the first element has index 1).
        :param to_pos: Move tracks to this position (1-based index).
        :param range_length: Number of tracks to move (default: 1).
        :param resources: If specified, then replace the items from `from_pos` to `from_pos+range_length` with the
            specified set of Spotify URIs (it must be a collection with the same length as the range).
        
Move or replace elements in a playlist.
Move or replace elements in a playlist .
def playlist_move(self, playlist: str, from_pos: int, to_pos: int, range_length: int = 1,
                      resources: Optional[Union[str, Iterable[str]]] = None, **_):
        playlist = self._get_playlist(playlist)
        response = self.spotify_user_call(
            f'/v1/playlists/{playlist["id"]}/tracks',
            method='put',
            json={
                'range_start': int(from_pos) + 1,
                'range_length': int(range_length),
                'insert_before': int(to_pos) + 1,
                **({'uris': [
                    uri.strip() for uri in (
                        resources.split(',') if isinstance(resources, str) else resources
                    )
                ]} if resources else {})
            }
        )
        snapshot_id = response.get('snapshot_id')
        assert snapshot_id is not None, 'Could not save playlist'
def playlist_move ( self , playlist : str , from_pos : int , to_pos : int , range_length : int = 1 , resources : Optional [ Union [ str , Iterable [ str ] ] ] = None , ** _ ) : playlist = self . _get_playlist ( playlist ) response = self . spotify_user_call ( f'/v1/playlists/{playlist["id"]}/tracks' , method = 'put' , json = { 'range_start' : int ( from_pos ) + 1 , 'range_length' : int ( range_length ) , 'insert_before' : int ( to_pos ) + 1 , ** ( { 'uris' : [ uri . strip ( ) for uri in ( resources . split ( ',' ) if isinstance ( resources , str ) else resources ) ] } if resources else { } ) } ) snapshot_id = response . get ( 'snapshot_id' ) assert snapshot_id is not None , 'Could not save playlist'
Move or replace elements in a playlist.
Move or replace elements in a playlist .
"""
        Move or replace elements in a playlist.

        :param playlist: Playlist name, ID or URI.
        :param from_pos: Move tracks starting from this position (the first element has index 1).
        :param to_pos: Move tracks to this position (1-based index).
        :param range_length: Number of tracks to move (default: 1).
        :param resources: If specified, then replace the items from `from_pos` to `from_pos+range_length` with the
            specified set of Spotify URIs (it must be a collection with the same length as the range).
        """
self
playlist
str
Playlist name, ID or URI.
Playlist name ID or URI .
from_pos
int
Move tracks starting from this position (the first element has index 1).
Move tracks starting from this position ( the first element has index 1 ) .
to_pos
int
Move tracks to this position (1-based index).
Move tracks to this position ( 1 - based index ) .
range_length
int
Number of tracks to move (default: 1).
Number of tracks to move ( default : 1 ) .
resources
Optional[Union[str, Iterable[str]]]
If specified, then replace the items from `from_pos` to `from_pos+range_length` with the
specified set of Spotify URIs (it must be a collection with the same length as the range).
If specified then replace the items from ` from_pos ` to ` from_pos + range_length ` with the specified set of Spotify URIs ( it must be a collection with the same length as the range ) .