Пример #1
0
    def __init__(self,
                 process_list=None,
                 sample_rate=44100,
                 target_level=-24.0,
                 true_peak=-3.0,
                 bitrate='256k',
                 threading=False):
        self.logger = initialize_logger(self.__class__.__name__)

        self.show_string = str(self.__class__.__name__).replace('_', ' ')
        self.air_days_string = self.get_days_string()

        self.process_list = process_list

        self.file_list = self.get_file_list(process_list=self.process_list)
        self.source_paths = self.get_source_paths()
        self.destination_paths = self.get_destination_paths()

        self.threading = threading
        self.dry_run = Execution_Flags.DRY_RUN
        self.force = Execution_Flags.FORCE_PROCESS

        self.target_level = target_level
        self.sample_rate = sample_rate
        self.true_peak = true_peak
        self.bitrate = bitrate

        for var, value in self.__dict__.items():
            self.logger.debug(f'{var}: {value}')
Пример #2
0
def copy_all():
    logger = initialize_logger('COPY')
    start_run(logger)

    for each_file in FOR_FFA.iterdir():
        modified_date = each_file.stat().st_mtime
        modified_date_str = datetime.fromtimestamp(modified_date).strftime('%Y%m%d%H%M%S')


        static_chooser = Chooser()
        should_upload = static_chooser.date_compare(
                    modified_date_str
                ) and static_chooser.is_newer(
                    each_file.name,
                    modified_date_str,
                    local_file_dir=FFA_PATH
                )
        
        logger.debug(f'File: {each_file.name} modified {modified_date_str}')
        logger.debug(f'Should Upload? {should_upload}')
        
        if should_upload and each_file.suffix in ['.mp3', '.wav']:
            print(f'Copying {each_file.name} from {each_file.parent.stem} to FFA')
            try:
                shutil.copyfile(
                    str(each_file),
                    str(FFA_PATH.joinpath(each_file.name))
                )
            except Exception as e:
                print(Fore.RED, Style.BRIGHT, 'COPY ERROR: ', e, Style.RESET_ALL)
                logger.warn(f'COPY FAILED: {e.__class__.__name__} - {e}')

    for each_file in FOR_DROPBOX.iterdir():
        modified_date = datetime.fromtimestamp(each_file.stat().st_mtime)
        now = datetime.now()
        max_time = timedelta(minutes=60)

        should_upload = all([
            ((now - modified_date) < max_time),
            each_file.suffix in ['.mp3', '.wav'],
            ])

        logger.debug(f'File: {each_file.name} modified {modified_date.strftime("%Y%m%d%H%M%S")}')
        logger.debug(f'Should Upload? {should_upload}')

        if should_upload:
            print(f'Copying {each_file.name} from {each_file.parent.stem} to DROPBOX')
            try:
                shutil.copyfile(
                    str(each_file),
                    str(DROPBOX_PATH.joinpath(each_file.name))
                )
            except Exception as e:
                print(Fore.RED, Style.BRIGHT, 'COPY ERROR: ', e, Style.RESET_ALL)
                logger.warn(f'COPY FAILED: {e.__class__.__name__} - {e}')

    close_logger(logger)
Пример #3
0
    def __init__(self, download_list: list):

        self.logger = initialize_logger(self.__class__.__name__)

        self.download_list = download_list
        self.dry_run = Execution_Flags.DRY_RUN

        for var, value in self.__dict__.items():
            self.logger.debug(f'{var}: {value}')
Пример #4
0
def remove_directories():
    logger = initialize_logger('RESET')
    start_run(logger)
    logger.info('Removing audio file directories')

    for directory in RESET_DIRS:
        shutil.rmtree(str(directory), ignore_errors=True)

    close_logger(logger)
Пример #5
0
    def __init__(self, ftp_server, remote_dir: str, download_list: list):
        self.logger = initialize_logger(self.__class__.__name__)

        super().__init__(ftp_server, remote_dir)
        self.download_list = download_list
        # self.remote_dir = remote_dir
        # self.ftp_server = ftp_server
        self.dry_run = Execution_Flags.DRY_RUN

        for var, value in self.__dict__.items():
            self.logger.debug(f'{var.upper()}: {value}')
Пример #6
0
    def __init__(self,
                 process_only: bool = False,
                 threading: bool = False,
                 dry_run: bool = False):

        self.logger = initialize_logger('SATELLITE')
        start_run(self.logger)

        self.process_only = process_only
        self.threading = threading
        self.dry_run = dry_run

        for var, value in self.__dict__.items():
            self.logger.debug(f'{var}: {value}')
Пример #7
0
def connect(n=1):
    logger = initialize_logger('FTP')
    logger.debug(f'TIME_OUT = {TIME_OUT}')
    logger.debug(f'n = {n}')

    if n > TIME_OUT:
        return

    print(Fore.YELLOW, 'FTP CONNECTING...', end='', flush=True)

    server = FTP(PRX.IP)
    result = server.login(PRX.USERNAME, PRX.PASSWORD)
    if '230' in result:
        print(Fore.GREEN, Style.BRIGHT, result, Style.RESET_ALL)
        return server
    else:
        # does this interfere with linear backoff....?
        connect(n=n + 1)
Пример #8
0
    def __init__(self,
                 process_only: bool = False,
                 threading: bool = False,
                 dry_run: bool = False):

        self.logger = initialize_logger()
        start_run(self.logger)

        self.file_process_list = []
        self.process_only = process_only
        self.threading = threading
        self.dry_run = dry_run

        self.hash_verifier_class = verify.Hash_Verifier

        self.logger.info(f'PROCESS ONLY: {self.process_only}')
        self.logger.info(f'THREADING: {self.threading}')
        self.logger.info(f'DRY RUN: {self.dry_run}')

        for var, value in self.__dict__.items():
            self.logger.debug(f'{var}: {value}')