def search(): with self._lock: if self._searchText != txt: return res = songdb.search(txt) with self._lock: if self._searchText == txt: self._searchResults = res self.__class__.searchResults.updateEvent(self).push()
def search(): with self._lock: if self._searchText != txt: return res = songdb.search(txt) with self._lock: if self._searchText == txt: self._searchResults = res self.searchResults_updateEvent.push()
def cmdSearch(self, type, what): # ignore type. assume "any". anything else anyway not supported yet what = what.strip() if not what: return import songdb res = songdb.search(what) from Song import Song import os for entry in res: url = entry["url"] if not os.path.exists(url): continue song = Song(url=url) self.dumpSong(song=song)
def _resolve_txt_song(txt, single=True, only_good_rated=False): songs = songdb.search(txt) if songs: if len(songs) == 1: return songs songs.sort(lambda s1, s2: s1.get("rating", 0) > s2.get("rating", 0)) if single: return songs[:1] if only_good_rated: rated_songs = [s for s in songs if s.get("rating", 0) > 0] if rated_songs: return rated_songs return songs return []
def _resolve_txt_song(txt, single=True, only_good_rated=False): songs = songdb.search(txt) if songs: if len(songs) == 1: return songs songs.sort(lambda s1,s2: s1.get("rating", 0) > s2.get("rating", 0)) if single: return songs[:1] if only_good_rated: rated_songs = [s for s in songs if s.get("rating",0) > 0] if rated_songs: return rated_songs return songs return []
def searchText(self, updateText=None): if updateText is not None and self._searchText != updateText: self._searchText = updateText self._searchResults = songdb.search(updateText) self.searchResults_updateEvent.push() return self._searchText
def search(s): songs = songdb.search(s) songs = [s for s in songs if s.get("rating", 0) > 0] songs.sort(lambda s1, s2: s1.get("rating") > s2.get("rating")) return ["%s - %s" % (s["artist"], s["title"]) for s in songs]
def search(s): songs = songdb.search(s) songs = [s for s in songs if s.get("rating",0) > 0] songs.sort(lambda s1,s2: s1.get("rating") > s2.get("rating")) return ["%s - %s" % (s["artist"], s["title"]) for s in songs]