From 33cef9c56ea857df916c6613823442b8a6319ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dejan=20Proki=C4=87?= Date: Sat, 25 Jul 2015 12:21:57 +0200 Subject: [PATCH] config: Add config for data/config/cache directories Issue #843 --- docs/config.rst | 12 ++++++++++++ mopidy/config/__init__.py | 3 +++ mopidy/config/default.conf | 3 +++ 3 files changed, 18 insertions(+) diff --git a/docs/config.rst b/docs/config.rst index 3a919b5c..e12c152e 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -68,6 +68,18 @@ Core configuration The original MPD server only supports 10000 tracks in the tracklist. Some MPD clients will crash if this limit is exceeded. +.. confval:: core/cache_dir + + Path to directory for storing cached information. + +.. confval:: core/config_dir + + Path to directory with configuration files. + +.. confval:: core/data_dir + + Path to directory with data files. + Audio configuration ------------------- diff --git a/mopidy/config/__init__.py b/mopidy/config/__init__.py index 13a26412..df5b73bc 100644 --- a/mopidy/config/__init__.py +++ b/mopidy/config/__init__.py @@ -18,6 +18,9 @@ logger = logging.getLogger(__name__) _core_schema = ConfigSchema('core') # MPD supports at most 10k tracks, some clients segfault when this is exceeded. _core_schema['max_tracklist_length'] = Integer(minimum=1, maximum=10000) +_core_schema['cache_dir'] = Path() +_core_schema['config_dir'] = Path() +_core_schema['data_dir'] = Path() _logging_schema = ConfigSchema('logging') _logging_schema['color'] = Boolean() diff --git a/mopidy/config/default.conf b/mopidy/config/default.conf index c214de68..5e749f0c 100644 --- a/mopidy/config/default.conf +++ b/mopidy/config/default.conf @@ -1,5 +1,8 @@ [core] max_tracklist_length = 10000 +cache_dir = $XDG_CACHE_DIR/mopidy +config_dir = $XDG_CONFIG_DIR/mopidy +data_dir = $XDG_DATA_DIR/mopidy [logging] color = true