Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
		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()
Ejemplo n.º 3
0
		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()
Ejemplo n.º 4
0
	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)
Ejemplo n.º 5
0
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 []
Ejemplo n.º 6
0
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 []
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
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]
Ejemplo n.º 9
0
	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
Ejemplo n.º 10
0
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]