local: Add default config and config schema
This commit is contained in:
parent
d6d3e2be35
commit
74adefcad1
@ -2,8 +2,25 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import mopidy
|
import mopidy
|
||||||
from mopidy import ext
|
from mopidy import ext
|
||||||
|
from mopidy.utils import config, formatting
|
||||||
|
|
||||||
|
|
||||||
|
default_config = """
|
||||||
|
[ext.local]
|
||||||
|
|
||||||
|
# If the local extension should be enabled or not
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
# Path to folder with local music
|
||||||
|
music_path = $XDG_MUSIC_DIR
|
||||||
|
|
||||||
|
# Path to playlist folder with m3u files for local music
|
||||||
|
playlist_path = $XDG_DATA_DIR/mopidy/playlists
|
||||||
|
|
||||||
|
# Path to tag cache for local music
|
||||||
|
tag_cache_file = $XDG_DATA_DIR/mopidy/tag_cache
|
||||||
|
"""
|
||||||
|
|
||||||
__doc__ = """A backend for playing music from a local music archive.
|
__doc__ = """A backend for playing music from a local music archive.
|
||||||
|
|
||||||
This backend handles URIs starting with ``file:``.
|
This backend handles URIs starting with ``file:``.
|
||||||
@ -19,12 +36,12 @@ https://github.com/mopidy/mopidy/issues?labels=Local+backend
|
|||||||
|
|
||||||
- None
|
- None
|
||||||
|
|
||||||
**Settings:**
|
**Default config:**
|
||||||
|
|
||||||
- :attr:`mopidy.settings.LOCAL_MUSIC_PATH`
|
.. code-block:: ini
|
||||||
- :attr:`mopidy.settings.LOCAL_PLAYLIST_PATH`
|
|
||||||
- :attr:`mopidy.settings.LOCAL_TAG_CACHE_FILE`
|
%(config)s
|
||||||
"""
|
""" % {'config': formatting.indent(default_config)}
|
||||||
|
|
||||||
|
|
||||||
class Extension(ext.Extension):
|
class Extension(ext.Extension):
|
||||||
@ -33,10 +50,13 @@ class Extension(ext.Extension):
|
|||||||
version = mopidy.__version__
|
version = mopidy.__version__
|
||||||
|
|
||||||
def get_default_config(self):
|
def get_default_config(self):
|
||||||
return '[ext.local]'
|
return default_config
|
||||||
|
|
||||||
def validate_config(self, config):
|
def get_config_schema(self):
|
||||||
pass
|
schema = config.ExtensionConfigSchema()
|
||||||
|
schema['music_path'] = config.String()
|
||||||
|
schema['playlist_path'] = config.String()
|
||||||
|
schema['tag_cache_file'] = config.String()
|
||||||
|
|
||||||
def validate_environment(self):
|
def validate_environment(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user