"""Path constants for asset ingestor.""" import os import config from sys import exit as sysexit from integration_scripts import logger from integration_scripts.config import ENVIRONMENT, TEST_ENVIRONMENT from integration_scripts.file_utils import create_path_with_todays_date # 'PhonofileAudio' source_audio = os.path.join( config.SOURCE_ROOT_FOLDER_PATH, config.AUDIO_FOLDER_NAME) # 'PhonofileBooklet' source_booklet = os.path.join( config.SOURCE_ROOT_FOLDER_PATH, config.BOOKLET_FOLDER_NAME) # 'PhonofileCover' source_cover = os.path.join( config.SOURCE_ROOT_FOLDER_PATH, config.COVER_FOLDER_NAME) orch_audio = 'orchard_audio' orch_booklet = 'orchard_booklet' orch_cover = 'orchard_cover' donefile_name = 'upload.done' # Orchard donefile is stored as function log_path = 'logs' completed = 'completed' if ENVIRONMENT == TEST_ENVIRONMENT: source_audio = 'assets/audio' # noqa source_booklet = 'assets/booklet' # noqa source_cover = 'assets/covers' # noqa orch_audio = 'tmp/ripper_feeder/ripped/audio' # noqa orch_booklet = 'tmp/ripper_feeder/ripped/booklet' # noqa orch_cover = 'tmp/ripper_feeder/ripped/covers' # noqa ripper_wav_folder = 'lvona_test/WAV' ripper_tif_folder = 'lvona_test/TIF' target = create_path_with_todays_date(config.OUTPUT_PATH_DEV, subdir=True) else: try: # TODO Fix this issue with dates and non-dates target = create_path_with_todays_date(config.OUTPUT_PATH, subdir=True, skip_date=True) except PermissionError: logger.error( 'Unable to create paths. Is this an unmounted network ' 'share?: {}', config.OUTPUT_PATH) sysexit() ripper_wav_folder = config.WAV_FOLDER_NAME ripper_tif_folder = config.TIF_FOLDER_NAME # os.makedirs(target, exist_ok=True) def orch_donefile_name(orch_upc): """Get the ripper-formatted donefile name Args: orch_upc: (str) UPC to be used for the formatted name Returns: (str) formatted name as `UPC.done` """ return '{}.done'.format(str(orch_upc))