def query_artist(self, artist): best_found = None best_conf = 0.0 library_type = None for t in self.artists: found, conf = (extract_one(artist, self.artists[t].keys()) or (None, 0)) if conf > best_conf and conf > 50: best_conf = conf best_found = found library_type = t return best_found, best_conf, 'artist', library_type
def query_song(self, song): best_found = None best_conf = 0 library_type = None for t in self.track_names: found, conf = (extract_one(song, self.track_names[t].keys()) or (None, 0)) if conf > best_conf and conf > 50: best_conf = conf best_found = found library_type = t return best_found, best_conf, 'song', library_type
def query_album(self, album): best_found = None best_conf = 0 library_type = None for t in self.albums: self.log.info(self.albums[t].keys()) found, conf = (extract_one(album, self.albums[t].keys()) or (None, 0)) if conf > best_conf and conf > 50: best_conf = conf best_found = found library_type = t self.log.info('ALBUMS') self.log.info((best_found, best_conf)) return best_found, best_conf, 'album', library_type
def generic_query(self, phrase): found, conf = extract_one(phrase, self.playlist.keys()) if conf > 50: return found, conf, 'generic', '' else: return NOTHING_FOUND