Skip to content

Instantly share code, notes, and snippets.

@grejppi
Last active January 8, 2019 14:54
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 grejppi/734700b8f8aee287352fc2d9e3f02c53 to your computer and use it in GitHub Desktop.
Save grejppi/734700b8f8aee287352fc2d9e3f02c53 to your computer and use it in GitHub Desktop.
import sys
from collections import defaultdict
import lilv
# FIXME: not sure if this is correct...
using_old_lilv = "lilv_nodes_begin" in dir(lilv)
show_details = '-d' in sys.argv or '--details' in sys.argv
required_total = defaultdict(set)
optional_total = defaultdict(set)
w = lilv.World()
w.load_all()
plugins = w.get_all_plugins()
for plugin in plugins:
required = plugin.get_required_features()
optional = plugin.get_optional_features()
uri = str(plugin.get_uri())
if using_old_lilv:
it = lilv.lilv_nodes_begin(required.me)
while not lilv.lilv_nodes_is_end(required, it):
feat = lilv.lilv_node_as_uri(lilv.lilv_nodes_get(required, it))
it = lilv.lilv_nodes_next(required, it)
required_total[feat].add(uri)
it = lilv.lilv_nodes_begin(optional.me)
while not lilv.lilv_nodes_is_end(optional, it):
feat = lilv.lilv_node_as_uri(lilv.lilv_nodes_get(optional, it))
it = lilv.lilv_nodes_next(optional, it)
optional_total[feat].add(uri)
else:
for feature in required:
required_total[str(feature)].add(uri)
for feature in optional:
optional_total[str(feature)].add(uri)
def bar(width, total, required, optional):
r = required / total
o = optional / total
r_width = round(r * width)
o_width = round(o * width)
r_bar = '\u2588' * r_width
o_bar = '\u2592' * o_width
return (r_bar + o_bar).ljust(width)
def fmt(s):
return s.replace('-', '\u2500').replace('+', '\u253c').replace('|', '\u2502')
if using_old_lilv:
total = plugins.size()
else:
total = len(plugins)
print("```")
print(total, "plugins installed on the system.")
print()
if show_details:
feature_uri_length = max((len(uri) for uri in required_total)) + len("<> ")
print(fmt("feature".ljust(feature_uri_length) + "| required by"))
for feature in sorted(required_total):
print(fmt("-" * feature_uri_length + "+------------"))
for i, plugin in enumerate(sorted(required_total[feature])):
if i == 0:
a = "<{}>".format(feature).ljust(feature_uri_length)
else:
a = " " * feature_uri_length
print(fmt(a + "| <" + plugin + ">"))
print()
print()
all_features = set()
all_features = all_features.union(set(required_total.keys()))
all_features = all_features.union(set(optional_total.keys()))
features_sorted = [(uri, len(required_total[uri]), len(optional_total[uri])) for uri in all_features]
features_sorted.sort(key=lambda x: x[0])
features_sorted.sort(key=lambda x: x[2])
features_sorted.sort(key=lambda x: x[1])
features_sorted.reverse()
print(fmt("0% 100%| required | optional | feature"))
print(fmt("----------+----------+----------+---------"))
for uri, required, optional in features_sorted:
print(fmt("{}| {} | {} | <{}>".format(bar(10, total, required, optional), str(required).rjust(8), str(optional).rjust(8), uri)))
print("```")
@grejppi
Copy link
Author

grejppi commented Jan 6, 2019

532 plugins installed on the system.


0%    100%│ required │ optional │ feature
──────────┼──────────┼──────────┼─────────
███       │      182 │       18 │ <http://lv2plug.in/ns/ext/urid#map>
█         │       55 │        0 │ <http://lv2plug.in/ns/ext/options#options>
█▒        │       45 │       40 │ <http://lv2plug.in/ns/ext/buf─size#boundedBlockLength>
          │       11 │        1 │ <http://lv2plug.in/ns/ext/worker#schedule>
          │        4 │        0 │ <http://lv2plug.in/ns/ext/buf─size#fixedBlockLength>
          │        3 │        0 │ <http://lv2plug.in/ns/ext/buf─size#powerOf2BlockLength>
          │        2 │        0 │ <http://lv2plug.in/ns/lv2core#isLive>
          │        1 │        1 │ <http://lv2plug.in/ns/ext/state#loadDefaultState>
▒▒▒▒▒▒    │        0 │      307 │ <http://lv2plug.in/ns/lv2core#hardRTCapable>
▒         │        0 │       49 │ <http://lv2plug.in/ns/ext/port─props#supportsStrictBounds>
▒         │        0 │       47 │ <http://lv2plug.in/ns/ext/instance─access>
▒         │        0 │       47 │ <http://lv2plug.in/ns/ext/data─access>
          │        0 │       15 │ <http://lv2plug.in/ns/lv2core#hardRtCapable>
          │        0 │        1 │ <http://lv2plug.in/ns/extensions/ui#noUserResize>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/uri─map>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/state#threadSafeRestore>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/port─props/#supportsStrictBounds>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/event>

@diovudau
Copy link

diovudau commented Jan 6, 2019

error: failed to open file /home/nils/.lv2/Synthpod_default.preset.lv2/manifest.ttl (No such file or directory)
lilv_world_load_file(): error: Error loading file file:///home/nils/.lv2/Synthpod_default.preset.lv2/manifest.ttl' lilv_world_load_bundle(): error: Error reading file:///home/nils/.lv2/Synthpod_default.preset.lv2/manifest.ttl error: failed to open file /usr/lib/lv2/drumgizmo.lv2/manifest.ttl (No such file or directory) lilv_world_load_file(): error: Error loading file file:///usr/lib/lv2/drumgizmo.lv2/manifest.ttl'
lilv_world_load_bundle(): error: Error reading file:///usr/lib/lv2/drumgizmo.lv2/manifest.ttl

493 plugins installed on the system.


0%    100%│ required │ optional │ feature
──────────┼──────────┼──────────┼─────────
█████     │      236 │       14 │ <http://lv2plug.in/ns/ext/urid#map>
█▒        │       68 │       51 │ <http://lv2plug.in/ns/ext/buf─size#boundedBlockLength>
█         │       57 │        0 │ <http://lv2plug.in/ns/ext/options#options>
█         │       40 │        1 │ <http://lv2plug.in/ns/ext/worker#schedule>
          │       16 │       10 │ <http://lv2plug.in/ns/ext/state#loadDefaultState>
          │       16 │        0 │ <http://lv2plug.in/ns/ext/urid#unmap>
          │        7 │        0 │ <http://lv2plug.in/ns/ext/buf─size#fixedBlockLength>
▒         │        1 │       25 │ <http://lv2plug.in/ns/ext/state#threadSafeRestore>
          │        1 │        0 │ <http://lv2plug.in/ns/ext/state#makePath>
▒▒▒▒▒▒▒▒▒ │        0 │      434 │ <http://lv2plug.in/ns/lv2core#hardRTCapable>
▒         │        0 │       52 │ <http://lv2plug.in/ns/ext/port─props#supportsStrictBounds>
▒         │        0 │       32 │ <http://lv2plug.in/ns/lv2core#isLive>
          │        0 │       12 │ <http://harrisonconsoles.com/lv2/inlinedisplay#queue_draw>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/xpress#voiceMap>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/osc#schedule>
          │        0 │        5 │ <http://lv2plug.in/ns/ext/log#log>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/resize─port#resize>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/buf─size#coarseBlockLength>

@falkTX
Copy link

falkTX commented Jan 6, 2019

1112 plugins installed on the system.


0%    100%│ required │ optional │ feature
──────────┼──────────┼──────────┼─────────
████      │      442 │       28 │ <http://lv2plug.in/ns/ext/urid#map>
█▒        │      160 │       65 │ <http://lv2plug.in/ns/ext/buf─size#boundedBlockLength>
█         │       93 │        0 │ <http://lv2plug.in/ns/ext/buf─size#fixedBlockLength>
█         │       68 │        0 │ <http://lv2plug.in/ns/ext/options#options>
          │       43 │       17 │ <http://lv2plug.in/ns/ext/worker#schedule>
          │       17 │       12 │ <http://lv2plug.in/ns/ext/state#loadDefaultState>
          │       16 │        0 │ <http://lv2plug.in/ns/ext/urid#unmap>
          │        8 │        0 │ <http://lv2plug.in/ns/ext/buf─size#powerOf2BlockLength>
          │        3 │        1 │ <http://lv2plug.in/ns/ext/uri─map>
          │        3 │        1 │ <http://lv2plug.in/ns/ext/event>
          │        2 │       41 │ <http://lv2plug.in/ns/lv2core#isLive>
          │        1 │        1 │ <http://lv2plug.in/ns/ext/state#makePath>
▒▒▒▒▒▒▒   │        0 │      765 │ <http://lv2plug.in/ns/lv2core#hardRTCapable>
▒         │        0 │      100 │ <http://harrisonconsoles.com/lv2/inlinedisplay#queue_draw>
▒         │        0 │       60 │ <http://lv2plug.in/ns/ext/port─props#supportsStrictBounds>
          │        0 │       26 │ <http://lv2plug.in/ns/ext/state#threadSafeRestore>
          │        0 │       18 │ <http://lv2plug.in/ns/lv2core#hardRtCapable>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/xpress#voiceMap>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/osc#schedule>
          │        0 │        5 │ <http://lv2plug.in/ns/ext/log#log>
          │        0 │        3 │ <http://harrisonconsoles.com/lv2/inlinedisplay#in_gui>
          │        0 │        1 │ <http://open─music─kontrollers.ch/lv2/zero─worker#schedule>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/state#mapPath>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/buf─size#coarseBlockLength>

@ventosus
Copy link

ventosus commented Jan 6, 2019

602 plugins installed on the system.


0%    100%│ required │ optional │ feature
──────────┼──────────┼──────────┼─────────
█████     │      327 │        1 │ <http://lv2plug.in/ns/ext/urid#map>
█         │       66 │       10 │ <http://lv2plug.in/ns/ext/state#loadDefaultState>
█         │       52 │        9 │ <http://lv2plug.in/ns/ext/options#options>
█         │       39 │       19 │ <http://lv2plug.in/ns/ext/worker#schedule>
          │       20 │        0 │ <http://lv2plug.in/ns/ext/urid#unmap>
▒         │       17 │       49 │ <http://lv2plug.in/ns/ext/buf─size#boundedBlockLength>
▒         │        4 │       37 │ <http://lv2plug.in/ns/ext/log#log>
▒         │        1 │       74 │ <http://lv2plug.in/ns/ext/state#threadSafeRestore>
▒▒▒▒▒▒▒▒▒▒│        0 │      586 │ <http://lv2plug.in/ns/lv2core#hardRTCapable>
▒▒        │        0 │      106 │ <http://harrisonconsoles.com/lv2/inlinedisplay#queue_draw>
▒         │        0 │       84 │ <http://lv2plug.in/ns/lv2core#isLive>
▒         │        0 │       52 │ <http://lv2plug.in/ns/ext/port─props#supportsStrictBounds>
          │        0 │       26 │ <http://open─music─kontrollers.ch/lv2/xpress#voiceMap>
          │        0 │       11 │ <http://open─music─kontrollers.ch/lv2/osc#schedule>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/uri─map>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/event>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/buf─size#coarseBlockLength>

@SpotlightKid
Copy link

811 plugins installed on the system.


0%    100%│ required │ optional │ feature
──────────┼──────────┼──────────┼─────────
████      │      319 │       11 │ <http://lv2plug.in/ns/ext/urid#map>
█▒        │       65 │       59 │ <http://lv2plug.in/ns/ext/buf─size#boundedBlockLength>
█         │       56 │        0 │ <http://lv2plug.in/ns/ext/options#options>
          │       39 │       19 │ <http://lv2plug.in/ns/ext/worker#schedule>
          │       16 │        0 │ <http://lv2plug.in/ns/ext/urid#unmap>
          │       12 │       12 │ <http://lv2plug.in/ns/ext/state#loadDefaultState>
          │        3 │        1 │ <http://lv2plug.in/ns/ext/uri─map>
          │        3 │        1 │ <http://lv2plug.in/ns/ext/event>
          │        3 │        0 │ <http://lv2plug.in/ns/ext/buf─size#fixedBlockLength>
          │        1 │       21 │ <http://lv2plug.in/ns/ext/state#threadSafeRestore>
          │        1 │        1 │ <http://lv2plug.in/ns/ext/state#makePath>
▒▒▒▒▒▒▒▒  │        0 │      610 │ <http://lv2plug.in/ns/lv2core#hardRTCapable>
▒         │        0 │      105 │ <http://harrisonconsoles.com/lv2/inlinedisplay#queue_draw>
▒         │        0 │       87 │ <http://lv2plug.in/ns/ext/port─props#supportsStrictBounds>
          │        0 │       38 │ <http://lv2plug.in/ns/lv2core#hardRtCapable>
          │        0 │       28 │ <http://lv2plug.in/ns/lv2core#isLive>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/xpress#voiceMap>
          │        0 │        9 │ <http://open─music─kontrollers.ch/lv2/osc#schedule>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/state#mapPath>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/log#log>
          │        0 │        1 │ <http://lv2plug.in/ns/ext/buf─size#coarseBlockLength>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment