From 07d4f6ddf2255432ae54b6df51ef52b62a0e32f4 Mon Sep 17 00:00:00 2001 From: rawdlite Date: Wed, 8 Jul 2015 23:43:40 +0200 Subject: [PATCH] Rename Mopidy-Files to Mopidy-File --- docs/ext/backends.rst | 6 +++--- docs/ext/{files.rst => file.rst} | 20 ++++++++++---------- docs/index.rst | 2 +- mopidy/{files => file}/__init__.py | 4 ++-- mopidy/{files => file}/backend.py | 2 +- mopidy/{files => file}/ext.conf | 2 +- mopidy/{files => file}/library.py | 18 ++++++++++-------- setup.py | 2 +- 8 files changed, 29 insertions(+), 27 deletions(-) rename docs/ext/{files.rst => file.rst} (72%) rename mopidy/{files => file}/__init__.py (94%) rename mopidy/{files => file}/backend.py (94%) rename mopidy/{files => file}/ext.conf (94%) rename mopidy/{files => file}/library.py (90%) diff --git a/docs/ext/backends.rst b/docs/ext/backends.rst index 19f59806..5f578e6f 100644 --- a/docs/ext/backends.rst +++ b/docs/ext/backends.rst @@ -65,10 +65,10 @@ https://github.com/tkem/mopidy-dleyna Provides a backend for playing music from Digital Media Servers using the `dLeyna `_ D-Bus interface. -Mopidy-Files -============ +Mopidy-File +=========== -Bundled with Mopidy. See :ref:`ext-files`. +Bundled with Mopidy. See :ref:`ext-file`. Mopidy-Grooveshark ================== diff --git a/docs/ext/files.rst b/docs/ext/file.rst similarity index 72% rename from docs/ext/files.rst rename to docs/ext/file.rst index 42120807..d31f53fd 100644 --- a/docs/ext/files.rst +++ b/docs/ext/file.rst @@ -1,10 +1,10 @@ -.. _ext-files: +.. _ext-file: ************ -Mopidy-Files +Mopidy-File ************ -Mopidy-Files is an extension for playing music from your local music archive. +Mopidy-File is an extension for playing music from your local music archive. It is bundled with Mopidy and enabled by default. It allows you to browse through your local file system. Only files that are considered playable will be shown. @@ -17,30 +17,30 @@ Configuration See :ref:`config` for general help on configuring Mopidy. -.. literalinclude:: ../../mopidy/files/ext.conf +.. literalinclude:: ../../mopidy/file/ext.conf :language: ini -.. confval:: files/enabled +.. confval:: file/enabled - If the files extension should be enabled or not. + If the file extension should be enabled or not. -.. confval:: files/media_dirs +.. 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. -.. confval:: files/show_dotfiles +.. confval:: file/show_dotfiles Whether to show hidden files and directories that start with a dot. Default is false. -.. confval:: files/follow_symlinks +.. confval:: file/follow_symlinks Whether to follow symbolic links found in :confval:`files/media_dir`. Directories and files that are outside the configured directories will not be shown. Default is false. -.. confval:: files/metadata_timeout +.. confval:: file/metadata_timeout Number of milliseconds before giving up scanning a file and moving on to the next file. Reducing the value might speed up the directory listing, diff --git a/docs/index.rst b/docs/index.rst index 8d621d26..9085024a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -96,7 +96,7 @@ Extensions :maxdepth: 2 ext/local - ext/files + ext/file ext/m3u ext/stream ext/http diff --git a/mopidy/files/__init__.py b/mopidy/file/__init__.py similarity index 94% rename from mopidy/files/__init__.py rename to mopidy/file/__init__.py index d547b256..089cf6e6 100644 --- a/mopidy/files/__init__.py +++ b/mopidy/file/__init__.py @@ -11,8 +11,8 @@ logger = logging.getLogger(__name__) class Extension(ext.Extension): - dist_name = 'Mopidy-Files' - ext_name = 'files' + dist_name = 'Mopidy-File' + ext_name = 'file' version = mopidy.__version__ def get_default_config(self): diff --git a/mopidy/files/backend.py b/mopidy/file/backend.py similarity index 94% rename from mopidy/files/backend.py rename to mopidy/file/backend.py index 2394881c..74b029e5 100644 --- a/mopidy/files/backend.py +++ b/mopidy/file/backend.py @@ -5,7 +5,7 @@ import logging import pykka from mopidy import backend -from mopidy.files import library +from mopidy.file import library logger = logging.getLogger(__name__) diff --git a/mopidy/files/ext.conf b/mopidy/file/ext.conf similarity index 94% rename from mopidy/files/ext.conf rename to mopidy/file/ext.conf index afdd1183..486619a1 100644 --- a/mopidy/files/ext.conf +++ b/mopidy/file/ext.conf @@ -1,4 +1,4 @@ -[files] +[file] enabled = true media_dirs = $XDG_MUSIC_DIR|Music diff --git a/mopidy/files/library.py b/mopidy/file/library.py similarity index 90% rename from mopidy/files/library.py rename to mopidy/file/library.py index 2a347f4b..d638d0f0 100644 --- a/mopidy/files/library.py +++ b/mopidy/file/library.py @@ -13,6 +13,7 @@ from mopidy.internal import path logger = logging.getLogger(__name__) FS_ENCODING = sys.getfilesystemencoding() + class FilesLibraryProvider(backend.LibraryProvider): """Library for browsing local files.""" # TODO: get_images that can pull from metadata and/or .folder.png etc? @@ -32,10 +33,10 @@ class FilesLibraryProvider(backend.LibraryProvider): def __init__(self, backend, config): super(FilesLibraryProvider, self).__init__(backend) self._media_dirs = list(self._get_media_dirs(config)) - self._follow_symlinks = config['files']['follow_symlinks'] - self._show_dotfiles = config['files']['show_dotfiles'] + self._follow_symlinks = config['file']['follow_symlinks'] + self._show_dotfiles = config['file']['show_dotfiles'] self._scanner = scan.Scanner( - timeout=config['files']['metadata_timeout']) + timeout=config['file']['metadata_timeout']) def browse(self, uri): logger.debug('Browsing files at: %s', uri) @@ -46,7 +47,7 @@ class FilesLibraryProvider(backend.LibraryProvider): if not self._is_in_basedir(os.path.realpath(local_path)): logger.warning( 'Rejected attempt to browse path (%s) outside dirs defined ' - 'in files/media_dirs config.', + 'in file/media_dirs config.', local_path.decode(FS_ENCODING, 'replace')) return [] for dir_entry in os.listdir(local_path): @@ -101,17 +102,18 @@ class FilesLibraryProvider(backend.LibraryProvider): return [track] def _get_media_dirs(self, config): - for entry in config['files']['media_dirs']: + for entry in config['file']['media_dirs']: media_dir = {} media_dir_split = entry.split('|', 1) local_path = path.expand_path( media_dir_split[0].encode(FS_ENCODING)) if not local_path: - logger.warn('Failed expanding path (%s) from files/media_dirs config value.', - media_dir_split[0]) + logger.warning('Failed expanding path (%s) from file/media_dirs' + 'config value.', + media_dir_split[0]) continue elif not os.path.isdir(local_path): - logger.warn('%s is not a directory', local_path) + logger.warning('%s is not a directory', local_path) continue media_dir['path'] = local_path if len(media_dir_split) == 2: diff --git a/setup.py b/setup.py index ec302548..ca121f74 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( 'mopidy.ext': [ 'http = mopidy.http:Extension', 'local = mopidy.local:Extension', - 'files = mopidy.files:Extension', + 'file = mopidy.file:Extension', 'm3u = mopidy.m3u:Extension', 'mpd = mopidy.mpd:Extension', 'softwaremixer = mopidy.softwaremixer:Extension',