iTunes Local Control Airplay Devices to Variable

Posted on
Mon Mar 14, 2022 12:40 pm
Monstergerm offline
Posts: 274
Joined: Sep 01, 2009

iTunes Local Control Airplay Devices to Variable

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

Posted on
Mon Oct 03, 2022 6:45 am
c64 offline
User avatar
Posts: 53
Joined: Oct 28, 2012
Location: Germany

Re: iTunes Local Control Airplay Devices to Variable

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?

Posted on
Mon Oct 03, 2022 11:31 am
Monstergerm offline
Posts: 274
Joined: Sep 01, 2009

Re: iTunes Local Control Airplay Devices to Variable

The latest version 2022.06 incorporates these upgrades.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests