diff --git a/docs/ext/local.rst b/docs/ext/local.rst index 23baa5d1..583a7427 100644 --- a/docs/ext/local.rst +++ b/docs/ext/local.rst @@ -62,29 +62,65 @@ Usage If you want use Mopidy to play music you have locally at your machine, you need to review and maybe change some of the local extension config values. See above -for a complete list. Then you need to generate a tag cache for your local +for a complete list. Then you need to generate a local library for your local music... -.. _generating-a-tag-cache: +.. _generating-a-local-library: -Generating a tag cache ----------------------- +Generating a local library +-------------------------- The command :command:`mopidy local scan` will scan the path set in the -:confval:`local/media_dir` config value for any media files and build a MPD -compatible ``tag_cache``. +:confval:`local/media_dir` config value for any audio files and build a +library. -To make a ``tag_cache`` of your local music available for Mopidy: +To make a local library for your music available for Mopidy: #. Ensure that the :confval:`local/media_dir` config value points to where your music is located. Check the current setting by running:: mopidy config -#. Scan your media library. The command writes the ``tag_cache`` to - the :confval:`local/tag_cache_file`:: +#. Scan your media library.:: mopidy local scan #. Start Mopidy, find the music library in a client, and play some local music! + + +Plugable library support +------------------------ + +Local libraries are fully pluggable. What this means is that users may opt to +disable the current default library `local-json`, replacing it with a third +party one. When running :command:`mopidy local scan` mopidy will populate +whatever the current active library is with data. Only one library may be +active at a time. + + +***************** +Mopidy-Local-JSON +***************** + +Extension for storing local music library in a JSON file, default built in +library for local files. + + +Default configuration +===================== + +.. literalinclude:: ../../mopidy/backends/local/json/ext.conf + :language: ini + + +Configuration values +==================== + +.. confval:: local-json/enabled + + If the local extension should be enabled or not. + +.. confval:: local-json/json_file + + Path to a file to store the gziped json data in. diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 7fa19f7a..2709690a 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -309,6 +309,10 @@ This is ``mopidy_soundspot/__init__.py``:: from .commands import SoundspotCommand return SoundspotCommand() + def get_library_updaters(self): + from .library import SoundspotLibraryUpdateProvider + return [SoundspotLibraryUpdateProvider] + def register_gstreamer_elements(self): from .mixer import SoundspotMixer gobject.type_register(SoundspotMixer) @@ -406,6 +410,38 @@ more details. return 0 +Example library provider +======================== + +Currently library providers are only really relevant for people who want to +replace the default local library. Providing this in addition to a backend that +exposes a library for the `local` uri scheme lets you plug in whatever storage +solution you happen to prefer. + +:: + + from mopidy.backends import base + + + class SoundspotLibraryUpdateProvider(base.BaseLibraryProvider): + def __init__(self, config): + super(SoundspotLibraryUpdateProvider, self).__init__(config) + self.config = config + + def load(self): + # Your track loading code + return tracks + + def add(self, track): + # Your code for handling adding a new track + + def remove(self, uri): + # Your code for removing the track coresponding to this uri + + def commit(self): + # Your code to persist the library, if needed. + + Example GStreamer element =========================