diff --git a/docs/ext/index.rst b/docs/ext/index.rst index a94295ec..bfa3237f 100644 --- a/docs/ext/index.rst +++ b/docs/ext/index.rst @@ -15,6 +15,7 @@ These extensions are created and maintained by Mopidy's core developers. They are installed together with Mopidy and are enabled by default. .. toctree:: + :maxdepth: 2 :glob: ** diff --git a/docs/ext/scrobbler.rst b/docs/ext/scrobbler.rst new file mode 100644 index 00000000..1d7b3d4b --- /dev/null +++ b/docs/ext/scrobbler.rst @@ -0,0 +1,46 @@ +**************** +Mopidy-Scrobbler +**************** + +This extension scrobbles the music you play to your `Last.fm +`_ profile. + +.. note:: + + This extension requires a free user account at Last.fm. + + +Dependencies +============ + +.. literalinclude:: ../../requirements/scrobbler.txt + + +Configuration values +==================== + +.. confval:: scrobbler/enabled + + If the scrobbler extension should be enabled or not. + +.. confval:: scrobbler/username + + Your Last.fm username. + +.. confval:: scrobbler/password + + Your Last.fm password. + + +Default configuration +===================== + +.. literalinclude:: ../../mopidy/frontends/scrobbler/ext.conf + :language: ini + + +Usage +===== + +The extension is enabled by default if all dependencies are available. You just +need to add your Last.fm username and password to the config file. diff --git a/docs/modules/frontends/scrobbler.rst b/docs/modules/frontends/scrobbler.rst deleted file mode 100644 index 2af9fcff..00000000 --- a/docs/modules/frontends/scrobbler.rst +++ /dev/null @@ -1,6 +0,0 @@ -*********************************************** -:mod:`mopidy.frontends.scrobbler` -- Scrobbler -*********************************************** - -.. automodule:: mopidy.frontends.scrobbler - :synopsis: Music scrobbler frontend diff --git a/mopidy/frontends/scrobbler/__init__.py b/mopidy/frontends/scrobbler/__init__.py index f3127040..a60823d7 100644 --- a/mopidy/frontends/scrobbler/__init__.py +++ b/mopidy/frontends/scrobbler/__init__.py @@ -1,53 +1,10 @@ from __future__ import unicode_literals +import os + import mopidy from mopidy import exceptions, ext -from mopidy.utils import config, formatting - - -default_config = """ -[scrobbler] -enabled = true -username = -password = -""" - -__doc__ = """ -Frontend which scrobbles the music you play to your -`Last.fm `_ profile. - -.. note:: - - This frontend requires a free user account at Last.fm. - -**Dependencies** - -.. literalinclude:: ../../../requirements/scrobbler.txt - -**Configuration** - -.. confval:: scrobbler/enabled - - If the scrobbler extension should be enabled or not. - -.. confval:: scrobbler/username - - Your Last.fm username. - -.. confval:: scrobbler/password - - Your Last.fm password. - -**Default config** - -.. code-block:: ini - -%(config)s - -**Usage** - -The frontend is enabled by default if all dependencies are available. -""" % {'config': formatting.indent(default_config)} +from mopidy.utils import config class Extension(ext.Extension): @@ -57,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/frontends/scrobbler/ext.conf b/mopidy/frontends/scrobbler/ext.conf new file mode 100644 index 00000000..4fded92f --- /dev/null +++ b/mopidy/frontends/scrobbler/ext.conf @@ -0,0 +1,4 @@ +[scrobbler] +enabled = true +username = +password =