Merge branch 'feature/file-excluded-file-exts' into develop
This commit is contained in:
commit
1d594bdacc
@ -13,21 +13,23 @@ Feature release.
|
|||||||
- Core: Mopidy restores its last state when started. Can be enabled by setting
|
- Core: Mopidy restores its last state when started. Can be enabled by setting
|
||||||
the config value :confval:`core/restore_state` to ``true``.
|
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: Update scanner to handle sources such as RTSP. (Fixes: :issue:`1479`)
|
||||||
|
|
||||||
- Audio: The scanner set the date to :attr:`mopidy.models.Track.date` and
|
- Audio: The scanner set the date to :attr:`mopidy.models.Track.date` and
|
||||||
:attr:`mopidy.models.Album.date`
|
:attr:`mopidy.models.Album.date`
|
||||||
(Fixes: :issue:`1741`)
|
(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)
|
v2.0.1 (2016-08-16)
|
||||||
===================
|
===================
|
||||||
|
|||||||
@ -27,18 +27,24 @@ See :ref:`config` for general help on configuring Mopidy.
|
|||||||
.. confval:: file/media_dirs
|
.. confval:: file/media_dirs
|
||||||
|
|
||||||
A list of directories to be browsable.
|
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
|
.. confval:: file/show_dotfiles
|
||||||
|
|
||||||
Whether to show hidden files and directories that start with a dot.
|
Whether to show hidden files and directories that start with a dot.
|
||||||
Default is false.
|
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
|
.. confval:: file/follow_symlinks
|
||||||
|
|
||||||
Whether to follow symbolic links found in :confval:`file/media_dirs`.
|
Whether to follow symbolic links found in :confval:`file/media_dirs`.
|
||||||
Directories and files that are outside the configured directories will not be shown.
|
Directories and files that are outside the configured directories will not
|
||||||
Default is false.
|
be shown. Default is false.
|
||||||
|
|
||||||
.. confval:: file/metadata_timeout
|
.. confval:: file/metadata_timeout
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class Extension(ext.Extension):
|
|||||||
def get_config_schema(self):
|
def get_config_schema(self):
|
||||||
schema = super(Extension, self).get_config_schema()
|
schema = super(Extension, self).get_config_schema()
|
||||||
schema['media_dirs'] = config.List(optional=True)
|
schema['media_dirs'] = config.List(optional=True)
|
||||||
|
schema['excluded_file_extensions'] = config.List(optional=True)
|
||||||
schema['show_dotfiles'] = config.Boolean(optional=True)
|
schema['show_dotfiles'] = config.Boolean(optional=True)
|
||||||
schema['follow_symlinks'] = config.Boolean(optional=True)
|
schema['follow_symlinks'] = config.Boolean(optional=True)
|
||||||
schema['metadata_timeout'] = config.Integer(optional=True)
|
schema['metadata_timeout'] = config.Integer(optional=True)
|
||||||
|
|||||||
@ -4,5 +4,8 @@ media_dirs =
|
|||||||
$XDG_MUSIC_DIR|Music
|
$XDG_MUSIC_DIR|Music
|
||||||
~/|Home
|
~/|Home
|
||||||
show_dotfiles = false
|
show_dotfiles = false
|
||||||
|
excluded_file_extensions =
|
||||||
|
.jpg
|
||||||
|
.jpeg
|
||||||
follow_symlinks = false
|
follow_symlinks = false
|
||||||
metadata_timeout = 1000
|
metadata_timeout = 1000
|
||||||
|
|||||||
@ -34,8 +34,12 @@ class FileLibraryProvider(backend.LibraryProvider):
|
|||||||
def __init__(self, backend, config):
|
def __init__(self, backend, config):
|
||||||
super(FileLibraryProvider, self).__init__(backend)
|
super(FileLibraryProvider, self).__init__(backend)
|
||||||
self._media_dirs = list(self._get_media_dirs(config))
|
self._media_dirs = list(self._get_media_dirs(config))
|
||||||
self._follow_symlinks = config['file']['follow_symlinks']
|
|
||||||
self._show_dotfiles = config['file']['show_dotfiles']
|
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(
|
self._scanner = scan.Scanner(
|
||||||
timeout=config['file']['metadata_timeout'])
|
timeout=config['file']['metadata_timeout'])
|
||||||
|
|
||||||
@ -60,6 +64,10 @@ class FileLibraryProvider(backend.LibraryProvider):
|
|||||||
if not self._show_dotfiles and dir_entry.startswith(b'.'):
|
if not self._show_dotfiles and dir_entry.startswith(b'.'):
|
||||||
continue
|
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:
|
if os.path.islink(child_path) and not self._follow_symlinks:
|
||||||
logger.debug('Ignoring symlink: %s', uri)
|
logger.debug('Ignoring symlink: %s', uri)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user