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