Page 1 of 1

iTunes Local Control Airplay Devices to Variable

PostPosted: Mon Mar 14, 2022 12:40 pm
by Monstergerm
Your plugin has the option of saving airplay devices to variable with the option of converting to string for display on control pages.
I think it would be very easy to achieve both, the conversion to string for display and keeping the info in list format for restoring devices.

Code: Select all
   
#-------------------------------------------------------------------------------
    def airplayDevicesToVariable(self, action):
        self.logger.debug(u'action "{}": {}'.format(action.description,action.props['variable']))
        devices = self.airplay.active_devices
        if action.props['convert']:
            devices = ', '.join(devices) # convert list to string
        variable_set(action.props['variable'],devices)

#-------------------------------------------------------------------------------
    def airplayDevicesFromVariable(self, action):
        self.logger.debug(u'action "{}": {}'.format(action.description,action.props['variable']))
        devices = variable_get(action.props['variable'])
        if "[u'" in devices: # we have a list
            self.airplay.active_devices = variable_get(action.props['variable'], list)
        else:
            devices = variable_get(action.props['variable'], str)
            devices = devices.split(', ')  #convert string to list
            devices = map(unicode, devices) #make unicode
            self.airplay.active_devices = devices



I also patched my plugin version with three actions that I think would be useful and are easy to add since they are already in the Apple Script portion:
save duration of the current track to variable
save player position to variable
set player position from variable

Re: iTunes Local Control Airplay Devices to Variable

PostPosted: Mon Oct 03, 2022 6:45 am
by c64
Saving player position & resuming player position from a variable is exactly what I am looking for. Would you be kind enough to share how you did it?

Re: iTunes Local Control Airplay Devices to Variable

PostPosted: Mon Oct 03, 2022 11:31 am
by Monstergerm
The latest version 2022.06 incorporates these upgrades.