예제 #1
0
파일: json.py 프로젝트: MacGyverQue/mopidy
 def search(self, query=None, limit=100, offset=0, uris=None, exact=False):
     tracks = self._tracks.values()
     # TODO: pass limit and offset into search helpers
     if exact:
         return search.find_exact(tracks, query=query, uris=uris)
     else:
         return search.search(tracks, query=query, uris=uris)
예제 #2
0
파일: json.py 프로젝트: icecast/mopidy
 def search(self, query=None, limit=100, offset=0, uris=None, exact=False):
     tracks = self._tracks.values()
     # TODO: pass limit and offset into search helpers
     if exact:
         return search.find_exact(tracks, query=query, uris=uris)
     else:
         return search.search(tracks, query=query, uris=uris)
예제 #3
0
    def test_find_exact_with_album_query(self):
        expected_tracks = [Track(album=Album(name="foo"))]
        tracks = [Track(), Track(album=Album(name="bar"))] + expected_tracks

        search_result = search.find_exact(tracks, {"album": ["foo"]})

        self.assertEqual(search_result.tracks, tuple(expected_tracks))
예제 #4
0
    def test_find_exact_with_album_query(self):
        expected_tracks = [Track(album=Album(name='foo'))]
        tracks = [Track(), Track(album=Album(name='bar'))] + expected_tracks

        search_result = search.find_exact(tracks, {'album': ['foo']})

        self.assertEqual(search_result.tracks, tuple(expected_tracks))
예제 #5
0
 def search(self, query=None, limit=100, offset=0, uris=None, exact=False):
     tracks = self._tracks.values()
     if exact:
         return search.find_exact(
             tracks, query=query, limit=limit, offset=offset, uris=uris)
     else:
         return search.search(
             tracks, query=query, limit=limit, offset=offset, uris=uris)
예제 #6
0
파일: json.py 프로젝트: CarnosOS/Peridot
 def search(self, query=None, limit=100, offset=0, uris=None, exact=False):
     tracks = self._tracks.values()
     if exact:
         return search.find_exact(
             tracks, query=query, limit=limit, offset=offset, uris=uris)
     else:
         return search.search(
             tracks, query=query, limit=limit, offset=offset, uris=uris)
예제 #7
0
 def find_exact(self, query=None, uris=None):
     try:
         log.debug("banshee::find_exact(%s,%s)" % (repr(query), uris))
         if query is None:
             return None
         if self._tracks is None:
             self._tracks = self.banshee_db.get_tracks()
         return search.find_exact(self._tracks, query, uris)
     except Exception as e:
         traceback.print_exc()
         raise e