Files
html/top-ia/plugin_loader.sh

21 lines
843 B
Bash
Executable File

#!/bin/bash
python3 -c "
import os, json
store = '/opt/weval-plugins'
plugins = []
ready = []
if os.path.isdir(store):
for d in sorted(os.listdir(store)):
meta = os.path.join(store, d, 'plugin.json')
if os.path.exists(meta):
try:
p = json.load(open(meta))
plugins.append(p['name'])
for i in p.get('intents', []):
script = os.path.join(store, d, i.get('script',''))
if os.path.exists(script) and os.access(script, os.X_OK):
ready.append({'name':i.get('name'),'regex':i.get('trigger_regex'),'script':script,'plugin':p.get('name')})
except Exception as e: pass
print(json.dumps({'discovered':len(plugins),'plugins':plugins,'intents_ready':len(ready),'intents':ready},ensure_ascii=False))
"