Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
Created August 14, 2020 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpotlightKid/900b27f62fbab37c0b096203be72a748 to your computer and use it in GitHub Desktop.
Save SpotlightKid/900b27f62fbab37c0b096203be72a748 to your computer and use it in GitHub Desktop.
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