Skip to content

Commit b98d1cd

Browse files
committed
Added adapter hooks support for otiopluginfo
Signed-off-by: Tim Lehr <[email protected]>
1 parent 23b28a6 commit b98d1cd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/py-opentimelineio/opentimelineio/adapters/adapter.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,9 @@ def plugin_info_map(self):
338338
result["supported features"] = features
339339

340340
for feature in sorted(_FEATURE_MAP.keys()):
341-
if feature in ["read", "write"]:
341+
if feature in ["read", "write", "hooks"]:
342342
continue
343+
343344
if self.has_feature(feature):
344345
features[feature] = collections.OrderedDict()
345346

@@ -356,6 +357,14 @@ def plugin_info_map(self):
356357
features[feature]["args"] = args.args
357358
features[feature]["doc"] = docs
358359

360+
# check if there are any adapter specific-hooks and get their names
361+
if self.has_feature("hooks"):
362+
adapter_hooks_names_fn = getattr(
363+
self.module(), _FEATURE_MAP["hooks"][0], None
364+
)
365+
if adapter_hooks_names_fn:
366+
features["hooks"] = adapter_hooks_names_fn()
367+
359368
return result
360369

361370

src/py-opentimelineio/opentimelineio/console/otiopluginfo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ def _supported_features_formatted(feature_map, _):
7575
if feature_map:
7676
print(" explicit supported features:")
7777
for thing, args in feature_map.items():
78+
# skip hooks, they are treated separately, see below
79+
if thing == "hooks":
80+
continue
7881
print(" {} args: {}".format(thing, args['args']))
82+
83+
# check if there are any adapter specific-hooks implemented
84+
adapter_hook_names = feature_map.get("hooks", [])
85+
if adapter_hook_names:
86+
print(" adapter hooks: {}".format(adapter_hook_names))
87+
7988
extra_features = []
8089
for kind in ["read", "write"]:
8190
if (

0 commit comments

Comments
 (0)