parent
b63642d873
commit
e0a028291a
@ -23,6 +23,12 @@ Bug fix release.
|
|||||||
:file:`/var/lib/mopidy/.local` and :file:`/var/lib/mopidy/.cache`. (Fixes:
|
:file:`/var/lib/mopidy/.local` and :file:`/var/lib/mopidy/.cache`. (Fixes:
|
||||||
:issue:`1259`)
|
:issue:`1259`)
|
||||||
|
|
||||||
|
- Local: Deprecate :confval:`local/data_dir` and respect
|
||||||
|
:confval:`core/data_dir` instead. This does not change the defaults for
|
||||||
|
desktop users, only system services installed from packages that properly set
|
||||||
|
:confval:`core/data_dir`, like the Debian and Arch packages. (Fixes:
|
||||||
|
:issue:`1259`)
|
||||||
|
|
||||||
- Stream: If "file" is present in the :confval:`stream/protocols` config value
|
- Stream: If "file" is present in the :confval:`stream/protocols` config value
|
||||||
and the :ref:`ext-file` extension is enabled, we exited with an error because
|
and the :ref:`ext-file` extension is enabled, we exited with an error because
|
||||||
two extensions claimed the same URI scheme. We now log a warning recommending
|
two extensions claimed the same URI scheme. We now log a warning recommending
|
||||||
|
|||||||
@ -47,8 +47,8 @@ active at a time.
|
|||||||
To create a new library provider you must create class that implements the
|
To create a new library provider you must create class that implements the
|
||||||
:class:`mopidy.local.Library` interface and install it in the extension
|
:class:`mopidy.local.Library` interface and install it in the extension
|
||||||
registry under ``local:library``. Any data that the library needs to store on
|
registry under ``local:library``. Any data that the library needs to store on
|
||||||
disc should be stored in :confval:`local/data_dir` using the library name as
|
disc should be stored in the extension's data dir, as returned by
|
||||||
part of the filename or directory to avoid any conflicts.
|
:meth:`~mopidy.ext.Extension.get_data_dir`.
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Extension(ext.Extension):
|
|||||||
schema = super(Extension, self).get_config_schema()
|
schema = super(Extension, self).get_config_schema()
|
||||||
schema['library'] = config.String()
|
schema['library'] = config.String()
|
||||||
schema['media_dir'] = config.Path()
|
schema['media_dir'] = config.Path()
|
||||||
schema['data_dir'] = config.Path()
|
schema['data_dir'] = config.Deprecated()
|
||||||
schema['playlists_dir'] = config.Deprecated()
|
schema['playlists_dir'] = config.Deprecated()
|
||||||
schema['tag_cache_file'] = config.Deprecated()
|
schema['tag_cache_file'] = config.Deprecated()
|
||||||
schema['scan_timeout'] = config.Integer(
|
schema['scan_timeout'] = config.Integer(
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
enabled = true
|
enabled = true
|
||||||
library = json
|
library = json
|
||||||
media_dir = $XDG_MUSIC_DIR
|
media_dir = $XDG_MUSIC_DIR
|
||||||
data_dir = $XDG_DATA_DIR/mopidy/local
|
|
||||||
scan_timeout = 1000
|
scan_timeout = 1000
|
||||||
scan_flush_threshold = 1000
|
scan_flush_threshold = 1000
|
||||||
scan_follow_symlinks = false
|
scan_follow_symlinks = false
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import tempfile
|
|||||||
import mopidy
|
import mopidy
|
||||||
from mopidy import compat, local, models
|
from mopidy import compat, local, models
|
||||||
from mopidy.internal import encoding, timer
|
from mopidy.internal import encoding, timer
|
||||||
from mopidy.local import search, storage, translator
|
from mopidy.local import Extension, search, storage, translator
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class JsonLibrary(local.Library):
|
|||||||
self._browse_cache = None
|
self._browse_cache = None
|
||||||
self._media_dir = config['local']['media_dir']
|
self._media_dir = config['local']['media_dir']
|
||||||
self._json_file = os.path.join(
|
self._json_file = os.path.join(
|
||||||
config['local']['data_dir'], b'library.json.gz')
|
Extension().get_data_dir(config), b'library.json.gz')
|
||||||
|
|
||||||
storage.check_dirs_and_files(config)
|
storage.check_dirs_and_files(config)
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,6 @@ from __future__ import absolute_import, unicode_literals
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from mopidy.internal import encoding, path
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -13,10 +11,3 @@ def check_dirs_and_files(config):
|
|||||||
logger.warning(
|
logger.warning(
|
||||||
'Local media dir %s does not exist.' %
|
'Local media dir %s does not exist.' %
|
||||||
config['local']['media_dir'])
|
config['local']['media_dir'])
|
||||||
|
|
||||||
try:
|
|
||||||
path.get_or_create_dir(config['local']['data_dir'])
|
|
||||||
except EnvironmentError as error:
|
|
||||||
logger.warning(
|
|
||||||
'Could not create local data dir: %s',
|
|
||||||
encoding.locale_decode(error))
|
|
||||||
|
|||||||
@ -45,10 +45,11 @@ class BrowseCacheTest(unittest.TestCase):
|
|||||||
class JsonLibraryTest(unittest.TestCase):
|
class JsonLibraryTest(unittest.TestCase):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
'core': {
|
||||||
|
'data_dir': path_to_data_dir(''),
|
||||||
|
},
|
||||||
'local': {
|
'local': {
|
||||||
'media_dir': path_to_data_dir(''),
|
'media_dir': path_to_data_dir(''),
|
||||||
'data_dir': path_to_data_dir(''),
|
|
||||||
'playlists_dir': b'',
|
|
||||||
'library': 'json',
|
'library': 'json',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,10 +65,11 @@ class LocalLibraryProviderTest(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
'core': {
|
||||||
|
'data_dir': path_to_data_dir(''),
|
||||||
|
},
|
||||||
'local': {
|
'local': {
|
||||||
'media_dir': path_to_data_dir(''),
|
'media_dir': path_to_data_dir(''),
|
||||||
'data_dir': path_to_data_dir(''),
|
|
||||||
'playlists_dir': b'',
|
|
||||||
'library': 'json',
|
'library': 'json',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -105,11 +106,15 @@ class LocalLibraryProviderTest(unittest.TestCase):
|
|||||||
|
|
||||||
tmpdir = tempfile.mkdtemp()
|
tmpdir = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
tmplib = os.path.join(tmpdir, 'library.json.gz')
|
tmpdir_local = os.path.join(tmpdir, 'local')
|
||||||
shutil.copy(path_to_data_dir('library.json.gz'), tmplib)
|
shutil.copytree(path_to_data_dir('local'), tmpdir_local)
|
||||||
|
|
||||||
config = {'local': self.config['local'].copy()}
|
config = {
|
||||||
config['local']['data_dir'] = tmpdir
|
'core': {
|
||||||
|
'data_dir': tmpdir,
|
||||||
|
},
|
||||||
|
'local': self.config['local'],
|
||||||
|
}
|
||||||
backend = actor.LocalBackend(config=config, audio=None)
|
backend = actor.LocalBackend(config=config, audio=None)
|
||||||
|
|
||||||
# Sanity check that value is in the library
|
# Sanity check that value is in the library
|
||||||
@ -117,6 +122,7 @@ class LocalLibraryProviderTest(unittest.TestCase):
|
|||||||
self.assertEqual(result, self.tracks[0:1])
|
self.assertEqual(result, self.tracks[0:1])
|
||||||
|
|
||||||
# Clear and refresh.
|
# Clear and refresh.
|
||||||
|
tmplib = os.path.join(tmpdir_local, 'library.json.gz')
|
||||||
open(tmplib, 'w').close()
|
open(tmplib, 'w').close()
|
||||||
backend.library.refresh()
|
backend.library.refresh()
|
||||||
|
|
||||||
|
|||||||
@ -23,12 +23,11 @@ from tests.local import generate_song, populate_tracklist
|
|||||||
class LocalPlaybackProviderTest(unittest.TestCase):
|
class LocalPlaybackProviderTest(unittest.TestCase):
|
||||||
config = {
|
config = {
|
||||||
'core': {
|
'core': {
|
||||||
|
'data_dir': path_to_data_dir(''),
|
||||||
'max_tracklist_length': 10000,
|
'max_tracklist_length': 10000,
|
||||||
},
|
},
|
||||||
'local': {
|
'local': {
|
||||||
'media_dir': path_to_data_dir(''),
|
'media_dir': path_to_data_dir(''),
|
||||||
'data_dir': path_to_data_dir(''),
|
|
||||||
'playlists_dir': b'',
|
|
||||||
'library': 'json',
|
'library': 'json',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,11 +18,11 @@ from tests.local import generate_song, populate_tracklist
|
|||||||
class LocalTracklistProviderTest(unittest.TestCase):
|
class LocalTracklistProviderTest(unittest.TestCase):
|
||||||
config = {
|
config = {
|
||||||
'core': {
|
'core': {
|
||||||
|
'data_dir': path_to_data_dir(''),
|
||||||
'max_tracklist_length': 10000
|
'max_tracklist_length': 10000
|
||||||
},
|
},
|
||||||
'local': {
|
'local': {
|
||||||
'media_dir': path_to_data_dir(''),
|
'media_dir': path_to_data_dir(''),
|
||||||
'data_dir': path_to_data_dir(''),
|
|
||||||
'playlists_dir': b'',
|
'playlists_dir': b'',
|
||||||
'library': 'json',
|
'library': 'json',
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user