From 9a09692e998ecc6588608d23dcaff577dca4e9f3 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 23 Mar 2010 00:44:15 +0100 Subject: [PATCH] docs: Moved the Mopidy settings file --- docs/api/settings.rst | 6 +++--- docs/installation/index.rst | 4 ++-- mopidy/settings/__init__.py | 16 +++++++++++----- mopidy/settings/default.py | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/api/settings.rst b/docs/api/settings.rst index 749f275d..7d85a68a 100644 --- a/docs/api/settings.rst +++ b/docs/api/settings.rst @@ -7,11 +7,11 @@ Changing settings ================= For any Mopidy installation you will need to change at least a couple of -settings. To do this, create a new file in the ``mopidy/settings/`` directory -named ``local.py`` and add settings you need to change from their defaults +settings. To do this, create a new file in the ``~/.mopidy/`` directory +named ``settings.py`` and add settings you need to change from their defaults there. -A complete ``mopidy/settings/local.py`` may look like this:: +A complete ``~/.mopidy/settings.py`` may look like this:: MPD_SERVER_HOSTNAME = u'0.0.0.0' SPOTIFY_USERNAME = u'alice' diff --git a/docs/installation/index.rst b/docs/installation/index.rst index 934c9181..e9121ed5 100644 --- a/docs/installation/index.rst +++ b/docs/installation/index.rst @@ -55,7 +55,7 @@ And on OS X, assuming you allready got git installed, e.g. from Homebrew:: Spotify settings ================ -Create a file named ``local.py`` in the directory ``mopidy/settings/``. Enter +Create a file named ``settings.py`` in the directory ``~/.mopidy/``. Enter your Spotify Premium account's username and password into the file, like this:: SPOTIFY_USERNAME = u'myusername' @@ -68,7 +68,7 @@ Switching backend Currently the despotify backend is the default. If you want to use the libspotify backend instead, copy the Spotify application key to ``mopidy/spotify_appkey.key``, and add the following to -``mopidy/mopidy/settings/local.py``:: +``~/.mopidy/settings.py``:: BACKENDS = (u'mopidy.backends.libspotify.LibspotifyBackend',) diff --git a/mopidy/settings/__init__.py b/mopidy/settings/__init__.py index 58715fd0..caee252e 100644 --- a/mopidy/settings/__init__.py +++ b/mopidy/settings/__init__.py @@ -1,6 +1,12 @@ -from mopidy.settings.default import * +import os -try: - from mopidy.settings.local import * -except ImportError: - pass +from mopidy.settings.default import * +from mopidy.utils import get_or_create_dotdir + +dotdir = get_or_create_dotdir() +settings_file = os.path.join(dotdir, u'settings.py') +if not os.path.isfile(settings_file): + logger.warning(u'Settings not found: %s', settings_file) +else: + sys.path.insert(0, dotdir) + from settings import * diff --git a/mopidy/settings/default.py b/mopidy/settings/default.py index 3466aef0..03b831b8 100644 --- a/mopidy/settings/default.py +++ b/mopidy/settings/default.py @@ -4,7 +4,7 @@ Available settings and their default values. .. warning:: Do *not* change settings in ``mopidy/settings/default.py``. Instead, add a - file called ``mopidy/settings/local.py`` and redefine settings there. + file called ``~/.mopidy/settings.py`` and redefine settings there. """ import sys