"""File methods for ripper-feeder.""" from integration_scripts.file_utils import create_path_with_todays_date, \ get_s3_file_key import config # TODO: add args, etc. to docstring def create_target_paths( asset_paths, orch_file_name, orch_flac_file_name, orch_upc, copy_local=False): """Create the paths needed for copy operations.""" tmp_target_path = None # Create final target path folder - ./Orchard_UPC/ asset_target_path_folder = get_s3_file_key( asset_paths.target, asset_paths.ripper_wav_folder, str(orch_upc)) # Create final target path file - ./Orchard_UPC/Orchard_UPC_###_###.wav asset_target_path = get_s3_file_key( asset_target_path_folder, orch_file_name) asset_flac_target_path = get_s3_file_key( asset_target_path_folder, orch_flac_file_name) # For local downloading. If needed, set target path to tmp if copy_local: # Get a tmp path with today's date temp_file_path = create_path_with_todays_date( config.TEMP_FILE_PATH) # Prepare tmp folder path tmp_target_path_folder = get_s3_file_key( temp_file_path, asset_paths.orch_audio, str(orch_upc)) # Prepare temp file path tmp_target_path = get_s3_file_key( tmp_target_path_folder, orch_file_name) # When copy local is used. tmp_flac_target_path = get_s3_file_key( tmp_target_path_folder, orch_flac_file_name) # Assign tmp destinations as targets target_path_folder = tmp_target_path_folder target_path = tmp_target_path flac_target_path = tmp_flac_target_path else: # Without local downloading, copy directly # Assign prod destinations as targets target_path_folder = asset_target_path_folder target_path = asset_target_path flac_target_path = asset_flac_target_path return \ target_path, target_path_folder, tmp_target_path, asset_target_path, \ flac_target_path