def resolve_ids(match, groups_len): alb_art = None alb_shcut = None tra_shcut = None if groups_len == 1: alb_art = match.group(1) elif groups_len == 2: alb_art = match.group(1) alb_shcut = match.group(2) elif groups_len == 3: alb_art = match.group(1) alb_shcut = match.group(2) tra_shcut = match.group(3) return client.resolve_id(alb_art, alb_shcut=alb_shcut, tra_shcut=tra_shcut)
def resolve_ids(alb_art, alb_id): if "." not in al_id: al_id = client.resolve_id(al_art, al_id) return al_id
cov_abs = None write_tags(pre_abs, meta, specs['fmt'], cov_abs) try: os.rename(pre_abs, post_abs) except OSError as e: print("Failed to rename track.") err(e) if cov_abs and not cfg['keep_cover']: os.remove(cov_abs) if __name__ == "__main__": title() cfg = parse_prefs() auth() num = 0 total = len(cfg['url']) for url in cfg['url']: num += 1 print("\nAlbum {} of {}:".format(num, total)) try: alb_art, alb_id, tra_id = check_url(url) except AttributeError: print("Invalid url:", url) continue alb_id = client.resolve_id(alb_art, alb_id) try: main(alb_id, tra_id) except exception as e: print("Album failed.") err(e)