How to use and test my self created frontend extension with a script

#1

A newbie question. How can I use my own self written Mopidy frontend extension written in Python? I made a simple extension and registered it witing the Mopidy server (‘python setup.py develop’.
). I used the cookiecutter template.

The extension has just one method ‘next_playlist’. But how can I actually use my extension using a simple script?

My final goal is to use my frontend extension on a Raspberry PI with 2 rotary encoders added to the GPIO pins. But first I’d like to write the extension and test is using a simple script. Is this a good path to go?

This is what I have so far:

// test script
from mopidy_myextension import Extension
print("tester")
ext = Extension()
ext.next_station()

// extension
import pykka
from mopidy import core
class MyExtensionFrontend(pykka.ThreadingActor, core.CoreListener, core.PlaylistsController):    
    def __init__(self, config, core):
        super(MyExtensionFrontend, self).__init__()
        self.core = core        
    # Your frontend implementation
    def next_station()
        #self.core.playback.next()
        print("next station called")

// error when run 'python tester.py'
AttributeError: 'Extension' object has no attribute 'next_station'

Thank you!

0 Likes