def main(): """main""" cur_path = os.path.abspath(".") desc = "TCC - Neural Nework." parser = argparse.ArgumentParser(description=desc) print("\n[ TCC - Neural Network ]\n%s\n" % desc) parser.add_argument('-i', '--input_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-f', '--input_file', required=True) parser.add_argument('-g', '--input_genre', required=True) parser.add_argument('-p', '--profile', default="profile.yml") parsed = parser.parse_args() output_folder = os.path.join(cur_path, "input") if not os.path.exists(output_folder): os.makedirs(output_folder) raw_input_path = run_esem( parsed.input_file, os.path.join(cur_path, "profile.yml"), output_folder ) run_nn( parsed.input_folder, raw_input_path, parsed.input_genre, parsed.input_file.split("/")[-1] )
def main(): """main""" desc = "This module reads the information from given folder." parser = argparse.ArgumentParser(description=desc) print("\n[ TCC - TRACK EXTRACTOR ]\n%s\n" % desc) parser.add_argument('-i', '--input_folder', default=utils.get_cur_location()) parser.add_argument('-f', '--output_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-o', '--output_file', default="output") parsed = parser.parse_args() csv_file = os.path.join(parsed.output_folder, parsed.output_file + ".txt") json_file = os.path.join(parsed.output_folder, parsed.output_file + ".json") content = walk_in_folders(parsed.input_folder) utils.write_file_with(csv_file, content) json_parser.parse(parsed.input_folder, csv_file, json_file) utils.show_message("All done, take a look: %s" % csv_file)
def main(): """main""" desc = "This module reads the information from given folder." parser = argparse.ArgumentParser(description=desc) print("\n[ TCC - TRACK EXTRACTOR ]\n%s\n" % desc) parser.add_argument('-i', '--input_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-o', '--output_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-p', '--profile', default="profile.yml") parsed = parser.parse_args() walk_in_folders(parsed.input_folder, os.path.join(parsed.output_folder, "parsed"))
def main(): """ main """ desc = "API LVL 1" parser = argparse.ArgumentParser(description=desc) print("\n[ TCC - API LVL 2 ]\n%s\n" % desc) parser.add_argument('-k', '--api_key', required=True) parser.add_argument('-f', '--input_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-i', '--input_file', default="level1") parser.add_argument('-o', '--output_file', default="level2") parsed = parser.parse_args() json_file = os.path.join(parsed.input_folder, parsed.input_file + ".json") output_file = os.path.join(parsed.input_folder, parsed.output_file + ".json") init_tests(parsed.api_key, json_file, output_file)
def main(): """ Create ffmpeg workers """ desc = "This module Create png images from songs." parser = argparse.ArgumentParser(description=desc) parser.add_argument('-n', '--total_number', default=1000) parser.add_argument('-w', '--workers_number', default=1) parser.add_argument('-o', '--output_folder', default="results/images") parsed = parser.parse_args() workers_number = int(parsed.workers_number) total = int(parsed.total_number) images_folder = utils.get_valid_folder_path(parsed.output_folder) tdb = TracksDb() for worker_number in range(0, workers_number): songs_path_list = [] print("\nNew Worker: %s\n" % worker_number) conditions = [{"field": "has_image", "value": "= 0"}] for track in tdb.get_tracks(conditions=conditions, limit=total): track['track'] = track['name'] tdb.update_track(track['id'], field="has_image", val=1, is_int=True) songs_path_list.append(track) cim_thread = Thread(target=create_images_from_list, args=( songs_path_list[:total], images_folder, )) cim_thread.start()
def main(): """ main """ desc = "API LVL 1" parser = argparse.ArgumentParser(description=desc) print("\n[ TCC - API XT MBID 1 ]\n%s\n" % desc) parser.add_argument('-k', '--api_key', required=True) parser.add_argument('-f', '--input_folder', default=utils.get_valid_folder_path("results")) parser.add_argument('-i', '--input_file', default="output") parser.add_argument('-lp', '--limit_population', default="no") parser.add_argument('-uo', '--untranslated_only', default="no") parser.add_argument('-tl', '--tracks_limit', default=300000) parsed = parser.parse_args() json_file = os.path.join(parsed.input_folder, parsed.input_file + ".json") if not os.path.exists(json_file): utils.show_message("File does not exists: %s" % json_file, 1) print("Please run previous steps first.\nAborting.") sys.exit(-1) tracks_limit = int(parsed.tracks_limit) limit_population = False if parsed.limit_population == "no" else True untranslated_only = False if parsed.untranslated_only == "no" else True last_fm_key = parsed.api_key http_py = Httpy() last_fm = LastFm(last_fm_key, "http", "ws.audioscrobbler.com/2.0/", "json", http_py) run_tests( json_file, last_fm, limit=limit_population, untranslated_only=untranslated_only, request_limit=tracks_limit )