diff --git a/docs/ext/spotify.rst b/docs/ext/spotify.rst new file mode 100644 index 00000000..0d3729b2 --- /dev/null +++ b/docs/ext/spotify.rst @@ -0,0 +1,68 @@ +.. _ext-spotify: + +************** +Mopidy-Spotify +************** + +An extension for playing music from Spotify. + +`Spotify `_ is a music streaming service. The backend +uses the official `libspotify +`_ library and the +`pyspotify `_ Python bindings for +libspotify. This backend handles URIs starting with ``spotify:``. + +See :ref:`music-from-spotify` for further instructions on using this backend. + +.. note:: + + This product uses SPOTIFY(R) CORE but is not endorsed, certified or + otherwise approved in any way by Spotify. Spotify is the registered + trade mark of the Spotify Group. + + +Known issues +============ + +https://github.com/mopidy/mopidy/issues?labels=Spotify+backend + + +Dependencies +============ + +.. literalinclude:: ../../requirements/spotify.txt + + +Configuration values +==================== + +.. confval:: spotify/enabled + + If the Spotify extension should be enabled or not. + +.. confval:: spotify/username + + Your Spotify Premium username. + +.. confval:: spotify/password + + Your Spotify Premium password. + +.. confval:: spotify/bitrate + + The preferred audio bitrate. Valid values are 96, 160, 320. + +.. confval:: spotify/timeout + + Max number of seconds to wait for Spotify operations to complete. + +.. confval:: spotify/cache_dir + + Path to the Spotify data cache. Cannot be shared with other Spotify apps. + + +Default configuration +===================== + +.. literalinclude:: ../../mopidy/backends/spotify/ext.conf + :language: ini diff --git a/docs/index.rst b/docs/index.rst index dd89c679..e5d21385 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ 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. +`, 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. diff --git a/docs/modules/backends/spotify.rst b/docs/modules/backends/spotify.rst deleted file mode 100644 index b410f272..00000000 --- a/docs/modules/backends/spotify.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _spotify-backend: - -************************************************* -:mod:`mopidy.backends.spotify` -- Spotify backend -************************************************* - -.. automodule:: mopidy.backends.spotify - :synopsis: Backend for the Spotify music streaming service diff --git a/mopidy/backends/spotify/__init__.py b/mopidy/backends/spotify/__init__.py index c26a42e7..d26c9cd3 100644 --- a/mopidy/backends/spotify/__init__.py +++ b/mopidy/backends/spotify/__init__.py @@ -1,77 +1,11 @@ from __future__ import unicode_literals +import os + import mopidy from mopidy import ext from mopidy.exceptions import ExtensionError -from mopidy.utils import config, formatting - - -default_config = """ -[spotify] -enabled = true -username = -password = -bitrate = 160 -timeout = 10 -cache_dir = $XDG_CACHE_DIR/mopidy/spotify -""" - -__doc__ = """A backend for playing music from Spotify - -`Spotify `_ is a music streaming service. The backend -uses the official `libspotify -`_ library and the -`pyspotify `_ Python bindings for -libspotify. This backend handles URIs starting with ``spotify:``. - -See :ref:`music-from-spotify` for further instructions on using this backend. - -.. note:: - - This product uses SPOTIFY(R) CORE but is not endorsed, certified or - otherwise approved in any way by Spotify. Spotify is the registered - trade mark of the Spotify Group. - -**Issues** - -https://github.com/mopidy/mopidy/issues?labels=Spotify+backend - -**Dependencies** - -.. literalinclude:: ../../../requirements/spotify.txt - -**Configuration** - -.. confval:: spotify/enabled - - If the Spotify extension should be enabled or not. - -.. confval:: spotify/username - - Your Spotify Premium username. - -.. confval:: spotify/password - - Your Spotify Premium password. - -.. confval:: spotify/bitrate - - The preferred audio bitrate. Valid values are 96, 160, 320. - -.. confval:: spotify/timeout - - Max number of seconds to wait for Spotify operations to complete. - -.. confval:: spotify/cache_dir - - Path to the Spotify data cache. Cannot be shared with other Spotify apps. - -**Default config** - -.. code-block:: ini - -%(config)s -""" % {'config': formatting.indent(default_config)} +from mopidy.utils import config class Extension(ext.Extension): @@ -81,7 +15,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/spotify/ext.conf b/mopidy/backends/spotify/ext.conf new file mode 100644 index 00000000..83bf191a --- /dev/null +++ b/mopidy/backends/spotify/ext.conf @@ -0,0 +1,7 @@ +[spotify] +enabled = true +username = +password = +bitrate = 160 +timeout = 10 +cache_dir = $XDG_CACHE_DIR/mopidy/spotify