def search_album_name(info): title = info['name'] results = parser.search_products(squash_str(title)) found = find_best_match(squash_str(title), results, threshold=0.5, key=lambda x: squash_str(x['title'])) return found
def search_album_catalog(catalog): catalog = catalog.split('~')[0] results = parser.search_products(squash_str(catalog)) found = find_best_match(squash_str(catalog), results, threshold=0.9, key=lambda x: squash_str(x['product_key'])) return found
def search_artist_album_name(info): if not ('composers' in info and len(info['composers']) > 0): return None artist = primary_name(info['composers'][0]['names']) title = info['name'] results = parser.search_products(squash_str(artist + " " + title)) found = find_best_match(squash_str(title), results, threshold=0.5, key=lambda x: squash_str(x['title'])) return found