The base class in e.g. plugins.music.mpd will be MusicMpdPlugin
This commit is contained in:
parent
091aa3223c
commit
2de28153f0
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import functools
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
@ -57,7 +58,13 @@ def _exec_func(body):
|
||||||
logging.info('Received push addressed to me: {}'.format(body))
|
logging.info('Received push addressed to me: {}'.format(body))
|
||||||
|
|
||||||
args = body['args'] if 'args' in body else {}
|
args = body['args'] if 'args' in body else {}
|
||||||
cls = getattr(module, body['plugin'].title() + 'Plugin')
|
cls = getattr(
|
||||||
|
module, functools.reduce(
|
||||||
|
lambda a,b: a.title() + b.title(),
|
||||||
|
(body['plugin'].title().split('.'))
|
||||||
|
) + 'Plugin'
|
||||||
|
)
|
||||||
|
|
||||||
instance = cls()
|
instance = cls()
|
||||||
out, err = instance.run(args)
|
out, err = instance.run(args)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue