2019-10-10 12:22:34 +02:00
|
|
|
import logging
|
2019-11-21 19:16:56 +01:00
|
|
|
import pathlib
|
2019-10-10 12:22:34 +02:00
|
|
|
|
|
|
|
from mopidy import config, ext
|
|
|
|
|
2019-10-10 14:16:37 +02:00
|
|
|
from .pinconfig import PinConfig
|
2019-10-10 12:22:34 +02:00
|
|
|
|
2019-11-12 10:58:16 +01:00
|
|
|
__version__ = "0.0.2"
|
2019-10-10 12:22:34 +02:00
|
|
|
|
2019-10-10 14:16:37 +02:00
|
|
|
|
2019-10-10 12:22:34 +02:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class Extension(ext.Extension):
|
|
|
|
|
|
|
|
dist_name = "Mopidy-Raspberry-GPIO"
|
|
|
|
ext_name = "raspberry-gpio"
|
|
|
|
version = __version__
|
|
|
|
|
|
|
|
def get_default_config(self):
|
2019-11-21 19:16:56 +01:00
|
|
|
return config.read(pathlib.Path(__file__).parent / "ext.conf")
|
2019-10-10 12:22:34 +02:00
|
|
|
|
|
|
|
def get_config_schema(self):
|
2019-11-21 19:11:43 +01:00
|
|
|
schema = super().get_config_schema()
|
2019-10-10 14:16:37 +02:00
|
|
|
for pin in range(28):
|
2019-11-21 19:11:43 +01:00
|
|
|
schema[f"bcm{pin:d}"] = PinConfig()
|
2019-10-10 12:22:34 +02:00
|
|
|
return schema
|
|
|
|
|
|
|
|
def setup(self, registry):
|
2019-10-10 14:16:37 +02:00
|
|
|
from .frontend import RaspberryGPIOFrontend
|
2019-11-21 19:13:31 +01:00
|
|
|
|
2019-10-10 14:16:37 +02:00
|
|
|
registry.add("frontend", RaspberryGPIOFrontend)
|