From ae7543a985dd1864948ef2b0d866b87fe9014473 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Fri, 12 Apr 2013 00:17:48 +0200 Subject: [PATCH] docs: Move local to ext registry --- docs/config.rst | 2 +- docs/ext/local.rst | 49 +++++++++++++++++++++++++++ docs/index.rst | 9 +++-- docs/modules/backends/local.rst | 8 ----- mopidy/backends/local/__init__.py | 56 +++---------------------------- mopidy/backends/local/ext.conf | 5 +++ 6 files changed, 64 insertions(+), 65 deletions(-) create mode 100644 docs/ext/local.rst delete mode 100644 docs/modules/backends/local.rst create mode 100644 mopidy/backends/local/ext.conf diff --git a/docs/config.rst b/docs/config.rst index cd75e6dc..097695d1 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -60,7 +60,7 @@ Music from local storage If you want use Mopidy to play music you have locally at your machine instead of or in addition to using Spotify, you need to review and maybe change some of -the local backend config values. See :ref:`local-backend`, for a complete list. +the local backend config values. See :ref:`ext-local`, for a complete list. Then you need to generate a tag cache for your local music... diff --git a/docs/ext/local.rst b/docs/ext/local.rst new file mode 100644 index 00000000..aa18cd5c --- /dev/null +++ b/docs/ext/local.rst @@ -0,0 +1,49 @@ +.. _ext-local: + +************ +Mopidy-Local +************ + +Extension for playing music from a local music archive. + +This backend handles URIs starting with ``file:``. See +:ref:`music-from-local-storage` for further instructions on using this backend. + + +Known issues +============ + +https://github.com/mopidy/mopidy/issues?labels=Local+backend + + +Dependencies +============ + +None. The extension just needs Mopidy. + + +Configuration values +==================== + +.. confval:: local/enabled + + If the local extension should be enabled or not. + +.. confval:: local/media_dir + + Path to directory with local media files. + +.. confval:: local/playlists_dir + + Path to playlists directory with m3u files for local media. + +.. confval:: local/tag_cache_file + + Path to tag cache for local media. + + +Default configuration +===================== + +.. literalinclude:: ../../mopidy/backends/local/ext.conf + :language: ini diff --git a/docs/index.rst b/docs/index.rst index 16518f53..bbf57fb5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,11 +3,10 @@ Mopidy ****** Mopidy is a music server which can play music both from multiple sources, like -your :ref:`local hard drive `, :ref:`radio streams -`, and from :ref:`Spotify ` and SoundCloud. Searches -combines results from all music sources, and you can mix tracks from all -sources in your play queue. Your playlists from Spotify or SoundCloud are also -available for use. +your :ref:`local hard drive `, :ref:`radio streams `, +and from :ref:`Spotify ` and SoundCloud. Searches combines results +from all music sources, and you can mix tracks from all sources in your play +queue. Your playlists from Spotify or SoundCloud are also available for use. To control your Mopidy music server, you can use one of Mopidy's :ref:`web clients `, the :ref:`Ubuntu Sound Menu `, any diff --git a/docs/modules/backends/local.rst b/docs/modules/backends/local.rst deleted file mode 100644 index 9ac93bc8..00000000 --- a/docs/modules/backends/local.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _local-backend: - -********************************************* -:mod:`mopidy.backends.local` -- Local backend -********************************************* - -.. automodule:: mopidy.backends.local - :synopsis: Backend for playing music files on local storage diff --git a/mopidy/backends/local/__init__.py b/mopidy/backends/local/__init__.py index 0367cf15..1a676e4a 100644 --- a/mopidy/backends/local/__init__.py +++ b/mopidy/backends/local/__init__.py @@ -1,57 +1,10 @@ from __future__ import unicode_literals +import os + import mopidy from mopidy import ext -from mopidy.utils import config, formatting - - -default_config = """ -[local] -enabled = true -media_dir = $XDG_MUSIC_DIR -playlists_dir = $XDG_DATA_DIR/mopidy/local/playlists -tag_cache_file = $XDG_DATA_DIR/mopidy/local/tag_cache -""" - -__doc__ = """A backend for playing music from a local music archive. - -This backend handles URIs starting with ``file:``. - -See :ref:`music-from-local-storage` for further instructions on using this -backend. - -**Issues** - -https://github.com/mopidy/mopidy/issues?labels=Local+backend - -**Dependencies** - -None - -**Configuration** - -.. confval:: local/enabled - - If the local extension should be enabled or not. - -.. confval:: local/media_dir - - Path to directory with local media files. - -.. confval:: local/playlists_dir - - Path to playlists directory with m3u files for local media. - -.. confval:: local/tag_cache_file - - Path to tag cache for local media. - -**Default config** - -.. code-block:: ini - -%(config)s -""" % {'config': formatting.indent(default_config)} +from mopidy.utils import config class Extension(ext.Extension): @@ -61,7 +14,8 @@ class Extension(ext.Extension): version = mopidy.__version__ def get_default_config(self): - return default_config + conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') + return open(conf_file).read() def get_config_schema(self): schema = config.ExtensionConfigSchema() diff --git a/mopidy/backends/local/ext.conf b/mopidy/backends/local/ext.conf new file mode 100644 index 00000000..54c3ab78 --- /dev/null +++ b/mopidy/backends/local/ext.conf @@ -0,0 +1,5 @@ +[local] +enabled = true +media_dir = $XDG_MUSIC_DIR +playlists_dir = $XDG_DATA_DIR/mopidy/local/playlists +tag_cache_file = $XDG_DATA_DIR/mopidy/local/tag_cache