예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 def generic_query(self, phrase):
     found, conf = extract_one(phrase, self.playlist.keys())
     if conf > 50:
         return found, conf, 'generic', ''
     else:
         return NOTHING_FOUND