Created
August 14, 2020 19:15
-
-
Save SpotlightKid/900b27f62fbab37c0b096203be72a748 to your computer and use it in GitHub Desktop.
List parent and children of an LV2 plugin class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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