More Python questioning...
Posted: Sat Sep 15, 2012 8:01 pm
Hi all, I'm hanging out a thought on a limb here....
When I get an object from the LOM, I can pass its 'ID' and 'value' out of a live.observer, as a list.
When I try to pass the 'ID' via OSC (from within the Python script), I cannot get this magical 'ID'.
To try and explain better;
tc = self.song().tracks
tcLocalPacker = []
tcLocalPacker.append(tc[0])
self.pObsObj.value = ['TrackZeroID', tcLocalPacker]
# (pObsObj is an object observed by a live.observer)
self.pObsObj.receive_value(['TrackZeroID', tcLocalPacker])
This works and sends the message out of the live.observer..... TrackZeroID id 1
So, if a new track were inserted at track 0, then
tcLocalPacker.append(tc[1]) will yield 'id 1'
.....however, moving over to OSC:
tcOscPacker = OSC.OSCMessage('/TrackZeroID')
tcOscPacker.append(tc[0])
self.oscEndpoint.sendMessage(tcOscPacker)
This sends the message via OSC, but sends only....... /TrackZeroID
I have tried
tcOscPacker.append(id(tc[0]))
This sends the message via OSC, as....... /TrackZeroID 504968850 (or something similar)
This unique number would be useable, if only it was persistent over set changes, as the live.observer method is.
With each change to the set, the ID changes.
I'm no python expert, but I have looked at weak referencing (which seems of no help) as a way of gleaning unique, persistent IDs.
Does anyone have any ideas on this, or how to access, in Python, the IDs as seen in M4L... or is this not possible?
I've thought of building a data structure based on 'what has changed and where' in the set, but this would be a huge task for me.
From the standpoint of the problem being caused by some other part of my code, for both M4L and OSC, the connection methods are working fine, no weirdness going on there, it's definitely a 'how do you get a pesky unique and persistent ID' situation!
Thanks for your time - I won't be holding my breath on this one!!!
Leigh
When I get an object from the LOM, I can pass its 'ID' and 'value' out of a live.observer, as a list.
When I try to pass the 'ID' via OSC (from within the Python script), I cannot get this magical 'ID'.
To try and explain better;
tc = self.song().tracks
tcLocalPacker = []
tcLocalPacker.append(tc[0])
self.pObsObj.value = ['TrackZeroID', tcLocalPacker]
# (pObsObj is an object observed by a live.observer)
self.pObsObj.receive_value(['TrackZeroID', tcLocalPacker])
This works and sends the message out of the live.observer..... TrackZeroID id 1
So, if a new track were inserted at track 0, then
tcLocalPacker.append(tc[1]) will yield 'id 1'
.....however, moving over to OSC:
tcOscPacker = OSC.OSCMessage('/TrackZeroID')
tcOscPacker.append(tc[0])
self.oscEndpoint.sendMessage(tcOscPacker)
This sends the message via OSC, but sends only....... /TrackZeroID
I have tried
tcOscPacker.append(id(tc[0]))
This sends the message via OSC, as....... /TrackZeroID 504968850 (or something similar)
This unique number would be useable, if only it was persistent over set changes, as the live.observer method is.
With each change to the set, the ID changes.
I'm no python expert, but I have looked at weak referencing (which seems of no help) as a way of gleaning unique, persistent IDs.
Does anyone have any ideas on this, or how to access, in Python, the IDs as seen in M4L... or is this not possible?
I've thought of building a data structure based on 'what has changed and where' in the set, but this would be a huge task for me.
From the standpoint of the problem being caused by some other part of my code, for both M4L and OSC, the connection methods are working fine, no weirdness going on there, it's definitely a 'how do you get a pesky unique and persistent ID' situation!
Thanks for your time - I won't be holding my breath on this one!!!
Leigh