Merge branch 'feature/file-excluded-file-exts' into develop

This commit is contained in:
Stein Magnus Jodal 2016-10-24 23:44:01 +02:00
commit 1d594bdacc
5 changed files with 33 additions and 13 deletions

View File

@ -13,21 +13,23 @@ Feature release.
- Core: Mopidy restores its last state when started. Can be enabled by setting
the config value :confval:`core/restore_state` to ``true``.
- MPD: Fix MPD protocol for ``replay_gain_status`` command. The actual command
remains unimplemented. (PR: :issue:`1520`)
- MPD: Add ``nextsong`` and ``nextsongid`` to the response of MPD ``status``
command. (Fixes: :issue:`1133`, :issue:`1516`, PR: :issue:`1523`)
- Local: Skip hidden directories directly in ``media_dir``.
(Fixes: :issue:`1559`, PR: :issue:`1555`)
- Audio: Update scanner to handle sources such as RTSP. (Fixes: :issue:`1479`)
- Audio: The scanner set the date to :attr:`mopidy.models.Track.date` and
:attr:`mopidy.models.Album.date`
(Fixes: :issue:`1741`)
- File: Add new config value :confval:`file/excluded_file_extensions`.
- Local: Skip hidden directories directly in ``media_dir``.
(Fixes: :issue:`1559`, PR: :issue:`1555`)
- MPD: Fix MPD protocol for ``replay_gain_status`` command. The actual command
remains unimplemented. (PR: :issue:`1520`)
- MPD: Add ``nextsong`` and ``nextsongid`` to the response of MPD ``status``
command. (Fixes: :issue:`1133`, :issue:`1516`, PR: :issue:`1523`)
v2.0.1 (2016-08-16)
===================

View File

@ -27,18 +27,24 @@ See :ref:`config` for general help on configuring Mopidy.
.. confval:: file/media_dirs
A list of directories to be browsable.
Optionally the path can be followed by ``|`` and a name that will be shown for that path.
Optionally the path can be followed by ``|`` and a name that will be shown
for that path.
.. confval:: file/show_dotfiles
Whether to show hidden files and directories that start with a dot.
Default is false.
.. confval:: file/excluded_file_extensions
File extensions to exclude when scanning the media directory. Values
should be separated by either comma or newline.
.. confval:: file/follow_symlinks
Whether to follow symbolic links found in :confval:`file/media_dirs`.
Directories and files that are outside the configured directories will not be shown.
Default is false.
Directories and files that are outside the configured directories will not
be shown. Default is false.
.. confval:: file/metadata_timeout

View File

@ -22,6 +22,7 @@ class Extension(ext.Extension):
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
schema['media_dirs'] = config.List(optional=True)
schema['excluded_file_extensions'] = config.List(optional=True)
schema['show_dotfiles'] = config.Boolean(optional=True)
schema['follow_symlinks'] = config.Boolean(optional=True)
schema['metadata_timeout'] = config.Integer(optional=True)

View File

@ -4,5 +4,8 @@ media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
show_dotfiles = false
excluded_file_extensions =
.jpg
.jpeg
follow_symlinks = false
metadata_timeout = 1000

View File

@ -34,8 +34,12 @@ class FileLibraryProvider(backend.LibraryProvider):
def __init__(self, backend, config):
super(FileLibraryProvider, self).__init__(backend)
self._media_dirs = list(self._get_media_dirs(config))
self._follow_symlinks = config['file']['follow_symlinks']
self._show_dotfiles = config['file']['show_dotfiles']
self._excluded_file_extensions = tuple(
bytes(file_ext.lower())
for file_ext in config['file']['excluded_file_extensions'])
self._follow_symlinks = config['file']['follow_symlinks']
self._scanner = scan.Scanner(
timeout=config['file']['metadata_timeout'])
@ -60,6 +64,10 @@ class FileLibraryProvider(backend.LibraryProvider):
if not self._show_dotfiles and dir_entry.startswith(b'.'):
continue
if (self._excluded_file_extensions and
dir_entry.endswith(self._excluded_file_extensions)):
continue
if os.path.islink(child_path) and not self._follow_symlinks:
logger.debug('Ignoring symlink: %s', uri)
continue