Files
Iris/mopidy_iris/__init__.py

48 lines
1.3 KiB
Python
Raw Normal View History

2016-10-30 07:51:39 +13:00
from __future__ import unicode_literals
import logging, os, json
import tornado.web
import tornado.websocket
from mopidy import config, ext
from frontend import IrisFrontend, make_iris_factory
2017-02-16 19:51:49 +13:00
from http import HttpHandler
from websocket import WebsocketHandler
2016-10-30 07:51:39 +13:00
logger = logging.getLogger(__name__)
2017-02-15 19:22:13 +13:00
__version__ = '2.12.1'
2016-10-30 07:51:39 +13:00
##
# Core extension class
#
# Loads config and gets the party started. Initiates any additional frontends, etc.
##
class Extension( ext.Extension ):
2016-10-30 07:51:39 +13:00
dist_name = 'Mopidy-Iris'
ext_name = 'iris'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
return config.read(conf_file)
def get_config_schema(self):
schema = config.ConfigSchema(self.ext_name)
schema['enabled'] = config.Boolean()
2016-10-30 07:51:39 +13:00
schema['pusherport'] = config.String()
schema['country'] = config.String()
schema['locale'] = config.String()
2016-10-30 07:51:39 +13:00
return schema
def setup(self, registry):
# Add web extension
registry.add('http:app', {
'name': self.ext_name,
'factory': make_iris_factory(
registry['http:app'],
registry['http:static']
)
2016-10-30 07:51:39 +13:00
})