2020-03-08 12:32:18 +01:00
|
|
|
import pathlib
|
2016-09-18 04:33:46 +02:00
|
|
|
|
2020-03-08 12:33:23 +01:00
|
|
|
import pkg_resources
|
|
|
|
|
2020-03-08 12:31:00 +01:00
|
|
|
from mopidy import config, ext
|
2016-09-18 04:33:46 +02:00
|
|
|
|
2020-03-08 12:33:23 +01:00
|
|
|
__version__ = pkg_resources.get_distribution("Mopidy-Subidy").version
|
2016-09-18 04:33:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SubidyExtension(ext.Extension):
|
|
|
|
|
2020-03-08 12:30:34 +01:00
|
|
|
dist_name = "Mopidy-Subidy"
|
|
|
|
ext_name = "subidy"
|
2016-09-18 04:33:46 +02:00
|
|
|
version = __version__
|
|
|
|
|
|
|
|
def get_default_config(self):
|
2020-03-08 12:32:18 +01:00
|
|
|
return config.read(pathlib.Path(__file__).parent / "ext.conf")
|
2016-09-18 04:33:46 +02:00
|
|
|
|
|
|
|
def get_config_schema(self):
|
2020-03-08 12:30:14 +01:00
|
|
|
schema = super().get_config_schema()
|
2020-03-08 12:30:34 +01:00
|
|
|
schema["url"] = config.String()
|
|
|
|
schema["username"] = config.String()
|
|
|
|
schema["password"] = config.Secret()
|
|
|
|
schema["legacy_auth"] = config.Boolean(optional=True)
|
|
|
|
schema["api_version"] = config.String(optional=True)
|
2016-09-18 04:33:46 +02:00
|
|
|
return schema
|
|
|
|
|
|
|
|
def setup(self, registry):
|
|
|
|
from .backend import SubidyBackend
|
2020-03-08 12:30:34 +01:00
|
|
|
|
|
|
|
registry.add("backend", SubidyBackend)
|