mpd: Add default config and config schema
This commit is contained in:
parent
8b538c4522
commit
aab7c01c94
@ -2,8 +2,41 @@ from __future__ import unicode_literals
|
||||
|
||||
import mopidy
|
||||
from mopidy import ext
|
||||
from mopidy.utils import config, formatting
|
||||
|
||||
|
||||
default_config = """
|
||||
[ext.mpd]
|
||||
|
||||
# If the MPD extension should be enabled or not
|
||||
enabled = true
|
||||
|
||||
# Which address the MPD server should bind to
|
||||
#
|
||||
# 127.0.0.1
|
||||
# Listens only on the IPv4 loopback interface
|
||||
# ::1
|
||||
# Listens only on the IPv6 loopback interface
|
||||
# 0.0.0.0
|
||||
# Listens on all IPv4 interfaces
|
||||
# ::
|
||||
# Listens on all interfaces, both IPv4 and IPv6
|
||||
hostname = 127.0.0.1
|
||||
|
||||
# Which TCP port the MPD server should listen to
|
||||
port = 6600
|
||||
|
||||
# The password required for connecting to the MPD server
|
||||
password =
|
||||
|
||||
# The maximum number of concurrent connections the MPD server will accept
|
||||
max_connections = 20
|
||||
|
||||
# Number of seconds an MPD client can stay inactive before the connection is
|
||||
# closed by the server
|
||||
connection_timeout = 60
|
||||
"""
|
||||
|
||||
__doc__ = """The MPD server frontend.
|
||||
|
||||
MPD stands for Music Player Daemon. MPD is an independent project and server.
|
||||
@ -14,11 +47,11 @@ original MPD server.
|
||||
|
||||
- None
|
||||
|
||||
**Settings:**
|
||||
**Default config:**
|
||||
|
||||
- :attr:`mopidy.settings.MPD_SERVER_HOSTNAME`
|
||||
- :attr:`mopidy.settings.MPD_SERVER_PORT`
|
||||
- :attr:`mopidy.settings.MPD_SERVER_PASSWORD`
|
||||
.. code-block:: ini
|
||||
|
||||
%(config)s
|
||||
|
||||
**Usage:**
|
||||
|
||||
@ -46,7 +79,7 @@ near future:
|
||||
- ``tagtypes`` is not supported
|
||||
- Browsing the file system is not supported
|
||||
- Live update of the music database is not supported
|
||||
"""
|
||||
""" % {'config': formatting.indent(default_config)}
|
||||
|
||||
|
||||
class Extension(ext.Extension):
|
||||
@ -55,10 +88,16 @@ class Extension(ext.Extension):
|
||||
version = mopidy.__version__
|
||||
|
||||
def get_default_config(self):
|
||||
return '[ext.mpd]'
|
||||
return default_config
|
||||
|
||||
def validate_config(self, config):
|
||||
pass
|
||||
def get_config_schema(self):
|
||||
schema = config.ExtensionConfigSchema()
|
||||
schema['hostname'] = config.Hostname()
|
||||
schema['port'] = config.Port()
|
||||
schema['password'] = config.String(optional=True, secret=True)
|
||||
schema['max_connections'] = config.Integer(minimum=1)
|
||||
schema['connection_timeout'] = config.Integer(minimum=1)
|
||||
return schema
|
||||
|
||||
def validate_environment(self):
|
||||
pass
|
||||
|
||||
Loading…
Reference in New Issue
Block a user