identifying sequences
russellaugust opened this issue · 3 comments
Has anyone found a simple way to identify if a mob is a sequence?
I've found a combination of attributes that gets me there (must be a CompositionMob with a usage_code of 0 and a sequence format type of 0) but there should be a single attribute that indicates it's a sequences (and not a multicam). I've been combing through readouts trying to find it with no luck.
Anyone find this?
following up, this is my current approach that doesn't feel bullet proof.
with avb.open(avb_filepath) as f:
for item in f.content.items:
mobtype_id = item.mob.property_data['mob_type_id']
usage_code = item.mob.property_data['usage_code']
if mobtype_id == 1 and usage_code == 0:
do_a_thing(item)
Feels like there should be a more sure-fire direct way to access them. I worry this approach might cross wires with multiclips because they seem to share all of the same properties. I couldn't find anything that made them fully distinct, aside from usage
which isn't perfect.
That should be correct, or you can use
mob.mob_type == 'CompositionMob' and mob.usage_code == 0
groupclips have a usage_code of 4
https://github.com/markreidvfx/pyavb/blob/main/src/avb/trackgroups.py#L1086
https://github.com/markreidvfx/pyavb/blob/main/src/avb/trackgroups.py#L1121
https://github.com/markreidvfx/pyavb/blob/main/examples/avb2aaf.py#L764
Worked out the following. If there's a more authoritative listing or existing method already in the library, all the better, but so far this has been helpful:
def getBinItemType(mob_type_id, usage_code):
theseTypes = {"1:0":"Sequence", "2:0":"Master Clip", "1:2":"Subclip", "1:4":"Group Clip", "1:3":"FX"}
# Where FX include things like TC Burn-In, Subcaps, files imported with alpha, etc
thisCombo = str(mob_type_id) + ":" + str(usage_code)
return theseTypes[thisCombo]