platypush/plugins/music/spotify/__init__.py
def random(self, value: Optional[bool] = None, device: Optional[str] = None):
        """
        Set or toggle random/shuffle mode.

        :param value: If set, set the shuffle state this value (true/false). Default: None (toggle current state).
        :param device: Device ID or name. If none is specified then the action will target the currently active device.
        """
        if device:
            device = self._get_device(device)['id']

        if value is None:
            # noinspection PyUnresolvedReferences
            status = self.status().output
            state = True if status.get('device_id') != device or not status.get('random') else False
        else:
            state = value is True

        self.spotify_user_call(
            f'/v1/me/player/shuffle',
            method='put',
            params={
                'state': state,
                **({'device_id': device} if device else {}),
            },
        )

        Set or toggle random/shuffle mode.

        :param value: If set, set the shuffle state this value (true/false). Default: None (toggle current state).
        :param device: Device ID or name. If none is specified then the action will target the currently active device.
        
Set or toggle random/shuffle mode.
Set or toggle random / shuffle mode .
def random(self, value: Optional[bool] = None, device: Optional[str] = None):
        if device:
            device = self._get_device(device)['id']
        if value is None:
            status = self.status().output
            state = True if status.get('device_id') != device or not status.get('random') else False
        else:
            state = value is True
        self.spotify_user_call(
            f'/v1/me/player/shuffle',
            method='put',
            params={
                'state': state,
                **({'device_id': device} if device else {}),
            },
        )
def random ( self , value : Optional [ bool ] = None , device : Optional [ str ] = None ) : if device : device = self . _get_device ( device ) [ 'id' ] if value is None : status = self . status ( ) . output state = True if status . get ( 'device_id' ) != device or not status . get ( 'random' ) else False else : state = value is True self . spotify_user_call ( f'/v1/me/player/shuffle' , method = 'put' , params = { 'state' : state , ** ( { 'device_id' : device } if device else { } ) , } , )
Set or toggle random/shuffle mode.
Set or toggle random / shuffle mode .
"""
        Set or toggle random/shuffle mode.

        :param value: If set, set the shuffle state this value (true/false). Default: None (toggle current state).
        :param device: Device ID or name. If none is specified then the action will target the currently active device.
        """ # noinspection PyUnresolvedReferences
self
value
Optional[bool]
If set, set the shuffle state this value (true/false). Default: None (toggle current state).
If set set the shuffle state this value ( true / false ) . Default : None ( toggle current state ) .
device
Optional[str]
Device ID or name. If none is specified then the action will target the currently active device.
Device ID or name . If none is specified then the action will target the currently active device .