Hi guys!
I try to get started developing an own frontend to learn how extension development for mopidy is working.
My frontend tries to access mopidy core api as described in the documentation. Anyway I get errors and I tried to find out what is causing that error but for hours I didn’t reach any progress. Does somebody has an advice form me what I’m doing wrong?
Here ist he (really simple) code of my frontend class:
import pykka
import logging
import gpiozero as GPIO
from mopidy import core
logger = logging.getLogger(__name__)
class StephansMusicboxFrontend (pykka.ThreadingActor, core.CoreListener):
def __init__(self, config, core):
super(StephansMusicboxFrontend, self).__init__()
self.core = core
self.config = config
self._getCurrentVolume()
def _getCurrentVolume(self):
logger.info("try to get volume")
currentVolume = self.core.MixerController.get_volume()
logger.info(currentVolume)
I’m trying to get the current volume from mopidy and print this out in console. But this raises an error.
Can anybody give me please an advice? Many thanks!
Here is the error code:
ERROR 2020-03-12 11:30:54,644 [3532:MainThread] mopidy.commands
Got un-handled exception from StephansMusicboxFrontend
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mopidy/commands.py", line 240, in _actor_error_handling
yield
File "/usr/lib/python3/dist-packages/mopidy/commands.py", line 436, in start_frontends
frontend_class.start(config=config, core=core)
File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 91, in start
obj = cls(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/magister85-0.0.1-py3.7.egg/mopidy_stephans_musicbox/frontend.py", line 15, in __init__
self._getCurrentVolume()
File "/usr/local/lib/python3.7/dist-packages/magister85-0.0.1-py3.7.egg/mopidy_stephans_musicbox/frontend.py", line 19, in _getCurrentVolume
currentVolume = self.core.MixerController.get_volume()
File "/usr/lib/python3/dist-packages/pykka/_proxy.py", line 219, in __getattr__
raise AttributeError('{} has no attribute {!r}'.format(self, name))
AttributeError: <ActorProxy for Core (urn:uuid:c05a7c52-fb4b-4233-85b6-9994c0f80d1c), attr_path=()> has no attribute 'MixerController'