def generate_dupe_check_searchstrs(artists, album, catno=None): searchstrs = [] album = _sanitize_album_for_dupe_check(album) searchstrs += make_searchstrs(artists, album, normalize=True) if album is not None and re.search(r"vol[^u]", album.lower()): extra_alb_search = re.sub(r"vol[^ ]+", "volume", album, flags=re.IGNORECASE) searchstrs += make_searchstrs(artists, extra_alb_search, normalize=True) if album is not None and "untitled" in album.lower( ): # Filthy catno untitled rlses searchstrs += make_searchstrs(artists, catno or "", normalize=True) if album is not None and "/" in album: # Filthy singles searchstrs += make_searchstrs(artists, album.split("/")[0], normalize=True) elif catno and album is not None and catno.lower() in album.lower(): searchstrs += make_searchstrs(artists, "untitled", normalize=True) return filter_unnecessary_searchstrs(searchstrs)
def get_metadata(path, tags, rls_data=None): """ Get metadata pertaining to a release from various metadata sources. Have the user decide which sources to use, and then combine their information. """ click.secho(f"\nChecking metadata...", fg="cyan", bold=True) searchstrs = make_searchstrs(rls_data["artists"], rls_data["title"]) kwargs = (dict(artists=[a for a, _ in rls_data["artists"]], album=rls_data["title"]) if rls_data else {}) search_results = run_metasearch(searchstrs, filter=False, track_count=len(tags), **kwargs) choices = _print_search_results(search_results, rls_data) metadata = _select_choice(choices, rls_data) remove_various_artists(metadata["tracks"]) return metadata