http: Define extension
This commit is contained in:
parent
5b6fc25cf8
commit
0f1c4c1dff
@ -1,4 +1,11 @@
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import mopidy
|
||||
from mopidy import ext
|
||||
from mopidy.exceptions import ExtensionError
|
||||
|
||||
|
||||
__doc__ = """
|
||||
The HTTP frontends lets you control Mopidy through HTTP and WebSockets, e.g.
|
||||
from a web based client.
|
||||
|
||||
@ -477,5 +484,32 @@ Example to get started with
|
||||
and all events that are emitted.
|
||||
"""
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
# TODO Move import into method when FRONTENDS setting is removed
|
||||
from .actor import HttpFrontend
|
||||
|
||||
|
||||
class Extension(ext.Extension):
|
||||
|
||||
name = 'Mopidy-HTTP'
|
||||
version = mopidy.__version__
|
||||
|
||||
def get_default_config(self):
|
||||
return '[http]'
|
||||
|
||||
def validate_config(self, config):
|
||||
pass
|
||||
|
||||
def validate_environment(self):
|
||||
try:
|
||||
import cherrypy # noqa
|
||||
except ImportError as e:
|
||||
raise ExtensionError('Library cherrypy not found', e)
|
||||
|
||||
try:
|
||||
import ws4py # noqa
|
||||
except ImportError as e:
|
||||
raise ExtensionError('Library ws4py not found', e)
|
||||
|
||||
def get_frontend_classes(self):
|
||||
return [HttpFrontend]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user