MCPcopy Create free account
hub / github.com/Atarity/Lightpack / _setTarget

Method _setTarget

Software/apiexamples/liOSC/OSC.py:1287–1309  ·  view source on GitHub ↗

Add (i.e. subscribe) a new OSCTarget, or change the prefix for an existing OSCTarget. - address ((host, port) tuple): IP-address & UDP-port - prefix (string): The OSC-address prefix prepended to the address of each OSCMessage sent to this OSCTarget (optional)

(self, address, prefix=None, filters=None)

Source from the content-addressed store, hash-verified

1285 dst[addr] = bool
1286
1287 def _setTarget(self, address, prefix=None, filters=None):
1288 """Add (i.e. subscribe) a new OSCTarget, or change the prefix for an existing OSCTarget.
1289 - address ((host, port) tuple): IP-address & UDP-port
1290 - prefix (string): The OSC-address prefix prepended to the address of each OSCMessage
1291 sent to this OSCTarget (optional)
1292 """
1293 if address not in self.targets.keys():
1294 self.targets[address] = ["",{}]
1295
1296 if prefix != None:
1297 if len(prefix):
1298 # make sure prefix starts with ONE '/', and does not end with '/'
1299 prefix = '/' + prefix.strip('/')
1300
1301 self.targets[address][0] = prefix
1302
1303 if filters != None:
1304 if type(filters) in types.StringTypes:
1305 (_, filters) = parseFilterStr(filters)
1306 elif type(filters) != types.DictType:
1307 raise TypeError("'filters' argument must be a dict with {addr:bool} entries")
1308
1309 self._updateFilters(self.targets[address][1], filters)
1310
1311 def setOSCTarget(self, address, prefix=None, filters=None):
1312 """Add (i.e. subscribe) a new OSCTarget, or change the prefix for an existing OSCTarget.

Callers 3

setOSCTargetMethod · 0.95
setOSCTargetFromStrMethod · 0.95
_subscribeMethod · 0.80

Calls 2

_updateFiltersMethod · 0.95
parseFilterStrFunction · 0.85

Tested by

no test coverage detected