core: Update BaseLibraryProvider to not require refresh, search or find_exact.

These methods may now return None, and the core code has been updated to filter
out missing SearchResults.
This commit is contained in:
Thomas Adamcik 2013-01-01 16:56:34 +01:00 committed by Stein Magnus Jodal
parent 795926cfa8
commit 6a0e80a5c3
3 changed files with 8 additions and 17 deletions

View File

@ -57,9 +57,9 @@ class BaseLibraryProvider(object):
"""
See :meth:`mopidy.core.LibraryController.find_exact`.
*MUST be implemented by subclass.*
*MAY be implemented by subclass.*
"""
raise NotImplementedError
pass
def lookup(self, uri):
"""
@ -73,17 +73,17 @@ class BaseLibraryProvider(object):
"""
See :meth:`mopidy.core.LibraryController.refresh`.
*MUST be implemented by subclass.*
*MAY be implemented by subclass.*
"""
raise NotImplementedError
pass
def search(self, **query):
"""
See :meth:`mopidy.core.LibraryController.search`.
*MUST be implemented by subclass.*
*MAY be implemented by subclass.*
"""
raise NotImplementedError
pass
class BasePlaybackProvider(object):

View File

@ -46,12 +46,3 @@ class StreamLibraryProvider(base.BaseLibraryProvider):
# Note that we would only want the stream metadata at this stage,
# not the currently playing track's.
return [Track(uri=uri, name=uri)]
def find_exact(self, **query):
return SearchResult()
def search(self, **query):
return SearchResult()
def refresh(self, uri=None):
pass

View File

@ -41,7 +41,7 @@ class LibraryController(object):
query = query or kwargs
futures = [
b.library.find_exact(**query) for b in self.backends.with_library]
return pykka.get_all(futures)
return [result for result in pykka.get_all(futures) if result]
def lookup(self, uri):
"""
@ -101,4 +101,4 @@ class LibraryController(object):
query = query or kwargs
futures = [
b.library.search(**query) for b in self.backends.with_library]
return pykka.get_all(futures)
return [result for result in pykka.get_all(futures) if result]