local: Review comments

This commit is contained in:
Thomas Adamcik 2013-12-28 00:17:31 +01:00
parent 565b3aeb98
commit 40af4c5f9e
2 changed files with 8 additions and 5 deletions

View File

@ -111,18 +111,20 @@ class Library(object):
"""
raise NotImplementedError
# TODO: support case with returning all tracks?
# TODO: remove uris?
# TODO: remove uris, replacing it with support in query language.
# TODO: remove exact, replacing it with support in query language.
def search(self, query=None, exact=False, uris=None):
"""
Search the library for tracks where ``field`` contains ``values``.
:param query: one or more queries to search for
:type query: dict
:param exact: look for exact matches?
:param exact: whether to look for exact matches
:type query: boolean
:param uris: zero or more URI roots to limit the search to
:type uris: list of strings or :class:`None`
:rtype: :class:`mopidy.models.SearchResult`
"""
raise NotImplementedError
# TODO: add file browsing support.

View File

@ -4,11 +4,12 @@ import logging
from mopidy.backends import base
logger = logging.getLogger('mopidy.backends.local')
logger = logging.getLogger('mopidy.backends.local.library')
class LocalLibraryProvider(base.BaseLibraryProvider):
"""Proxy library that delegates work to our active local library."""
def __init__(self, backend, library):
super(LocalLibraryProvider, self).__init__(backend)
self._library = library
@ -25,7 +26,7 @@ class LocalLibraryProvider(base.BaseLibraryProvider):
if not self._library:
return []
track = self._library.lookup(uri)
if not uri:
if track is None:
logger.debug('Failed to lookup %r', uri)
return []
return [track]