Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List parent and children of an LV2 plugin class
#!/usr/bin/env python
import sys
import lilv
if len(sys.argv) > 1:
pclass = sys.argv[1]
else:
pclass = "SimulatorPlugin"
world = lilv.World()
world.load_all()
plugin_classes = world.get_plugin_classes()
plugin_class = plugin_classes.get_by_uri(getattr(world.ns.lv2, pclass))
children = plugin_class.get_children()
if children:
for child in children:
print("%s <%s>" % (child.get_label(), child))
else:
print("Class %s has no children" % (plugin_class.get_label(),))
parent_uri = plugin_class.get_parent_uri()
if parent_uri is not None:
parent = plugin_classes.get_by_uri(parent_uri)
print("Class %s parent: %s <%s>" % (plugin_class.get_label(), parent.get_label(), parent_uri))
else:
print("Class %s has no parent" % (plugin_class.get_label(),))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.