From b9a7a9d2b6844e5204cacfbb645755a01a84b20a Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Fri, 17 Oct 2014 20:08:33 +0200 Subject: [PATCH] local: Add follow symlinks setting --- docs/ext/local.rst | 4 ++++ mopidy/local/__init__.py | 1 + mopidy/local/commands.py | 3 ++- mopidy/local/ext.conf | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/ext/local.rst b/docs/ext/local.rst index 31d00d66..18f66adc 100644 --- a/docs/ext/local.rst +++ b/docs/ext/local.rst @@ -86,6 +86,10 @@ See :ref:`config` for general help on configuring Mopidy. Number of milliseconds before giving up scanning a file and moving on to the next file. +.. confval:: local/scan_follow_symlinks + + If we should follow symlinks found in :confval:`local/media_dir` + .. confval:: local/scan_flush_threshold Number of tracks to wait before telling library it should try and store diff --git a/mopidy/local/__init__.py b/mopidy/local/__init__.py index fc1035fe..a0bb7bc4 100644 --- a/mopidy/local/__init__.py +++ b/mopidy/local/__init__.py @@ -29,6 +29,7 @@ class Extension(ext.Extension): schema['scan_timeout'] = config.Integer( minimum=1000, maximum=1000*60*60) schema['scan_flush_threshold'] = config.Integer(minimum=0) + schema['scan_follow_symlinks'] = config.Boolean() schema['excluded_file_extensions'] = config.List(optional=True) return schema diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index 04eff795..1b8981df 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -74,7 +74,8 @@ class ScanCommand(commands.Command): uris_to_update = set() uris_to_remove = set() - file_mtimes, file_errors = path.find_mtimes(media_dir) + file_mtimes, file_errors = path.find_mtimes( + media_dir, follow=config['local']['scan_follow_symlinks']) logger.info('Found %d files in media_dir.', len(file_mtimes)) diff --git a/mopidy/local/ext.conf b/mopidy/local/ext.conf index 9a0f19f1..535f4806 100644 --- a/mopidy/local/ext.conf +++ b/mopidy/local/ext.conf @@ -6,6 +6,7 @@ data_dir = $XDG_DATA_DIR/mopidy/local playlists_dir = $XDG_DATA_DIR/mopidy/local/playlists scan_timeout = 1000 scan_flush_threshold = 1000 +scan_follow_symlinks = false excluded_file_extensions = .directory .html