Python and Airfoil
Posted: Mon Oct 16, 2017 9:19 pm
So I've read the Wiki for AirFoil, and it has been a big help, since my Python ability is limited. I am curious about "chaining" commands... like the ability to connect 2 different speakers... or connect a speaker and set the volume....
While the following does work, I'm curious is there is a simpler way to do this, since most of the 2 commands are identical. I've tried a few things, re-arranging pieces, parts, deleting things that seemed redundant, including listing the execute actions part in (parentheses) back to back, then with a space, and then with a comma, but didn't get anywhere..
Is there a way to make multiple commands like this simpler?
While the following does work, I'm curious is there is a simpler way to do this, since most of the 2 commands are identical. I've tried a few things, re-arranging pieces, parts, deleting things that seemed redundant, including listing the execute actions part in (parentheses) back to back, then with a space, and then with a comma, but didn't get anywhere..
Is there a way to make multiple commands like this simpler?
- Code: Select all
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")
if airfoilPlugin.isEnabled():
try:
result = airfoilPlugin.executeAction("connect", deviceId= 1346544642, waitUntilDone=True) # ID of Speaker device
except Exception, e:
print "Exception occurred: %s" % unicode(e)
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")
if airfoilPlugin.isEnabled():
try:
result = airfoilPlugin.executeAction('setVolume', deviceId=1346544642, props={'volume': 52}, waitUntilDone=True) # ID of Speaker device
except Exception, e:
print "Exception occurred: %s" % unicode(e)