Rename Mopidy-Files to Mopidy-File
This commit is contained in:
parent
446a308200
commit
07d4f6ddf2
@ -65,10 +65,10 @@ https://github.com/tkem/mopidy-dleyna
|
||||
Provides a backend for playing music from Digital Media Servers using
|
||||
the `dLeyna <http://01.org/dleyna>`_ D-Bus interface.
|
||||
|
||||
Mopidy-Files
|
||||
============
|
||||
Mopidy-File
|
||||
===========
|
||||
|
||||
Bundled with Mopidy. See :ref:`ext-files`.
|
||||
Bundled with Mopidy. See :ref:`ext-file`.
|
||||
|
||||
Mopidy-Grooveshark
|
||||
==================
|
||||
|
||||
@ -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,
|
||||
@ -96,7 +96,7 @@ Extensions
|
||||
:maxdepth: 2
|
||||
|
||||
ext/local
|
||||
ext/files
|
||||
ext/file
|
||||
ext/m3u
|
||||
ext/stream
|
||||
ext/http
|
||||
|
||||
@ -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):
|
||||
@ -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__)
|
||||
@ -1,4 +1,4 @@
|
||||
[files]
|
||||
[file]
|
||||
enabled = true
|
||||
media_dirs =
|
||||
$XDG_MUSIC_DIR|Music
|
||||
@ -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:
|
||||
2
setup.py
2
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',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user