local: Add browse support to local library interface
This commit is contained in:
parent
3e3f59c1d0
commit
816d047a09
@ -64,6 +64,15 @@ class Library(object):
|
||||
def __init__(self, config):
|
||||
self._config = config
|
||||
|
||||
def browse(self, path):
|
||||
"""
|
||||
Browse directories and tracks at the given path.
|
||||
|
||||
:param string path: path to browse or None for root.
|
||||
:rtype: List of :class:`~mopidy.models.Ref` tracks and directories.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
(Re)load any tracks stored in memory, if any, otherwise just return
|
||||
|
||||
@ -50,6 +50,9 @@ class JsonLibrary(local.Library):
|
||||
self._json_file = os.path.join(
|
||||
config['local']['data_dir'], b'library.json.gz')
|
||||
|
||||
def browse(self, path):
|
||||
return []
|
||||
|
||||
def load(self):
|
||||
logger.debug('Loading json library from %s', self._json_file)
|
||||
library = load_library(self._json_file)
|
||||
|
||||
@ -17,6 +17,11 @@ class LocalLibraryProvider(backend.LibraryProvider):
|
||||
self._library = library
|
||||
self.refresh()
|
||||
|
||||
def browse(self, path):
|
||||
if not self._library:
|
||||
return []
|
||||
return self._library.browse(path)
|
||||
|
||||
def refresh(self, uri=None):
|
||||
if not self._library:
|
||||
return 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user