Module Gnumed.business.gmAppointments

Handling appointments.

Functions

def get_appointments_for_today_from_korganizer(verbose: bool = False) ‑> str
Expand source code
def get_appointments_for_today_from_korganizer(verbose:bool=False) -> str:
        """Generates the KOrganizer transfer file, a .csv file with today's events.

        Returns:
                KOrganizer transfer CSV file name, as created by konsolekalendar, or None.
                Note that the file may be empty, meaning there's no appointments.
        """
        today = pydt.date.today().isoformat()[:10]
        if __konsolekalendar_is_buggy() is False:
                csv_name = gmTools.get_unique_filename(prefix = 'konsolekalendar2gnumed-', suffix = '.csv')
                cmd_line = [
                        _KONSOLEKALENDAR_BINARY_NAME,
                        '--view',
                        '--date', today,
                        '--time', '00:00:00',
                        '--end-time', '23:59:59',
                        '--export-type', 'csv',
                        '--export-file', csv_name
                ]
                success, exitcode, stdout = gmShellAPI.run_process(cmd_line = cmd_line, timeout = _KONSOLEKALENDAR_TIMEOUT, verbose = verbose)
                if success:
                        return csv_name

                _log.error('problem running konsolekalendar')
                return None

        # at this point konsolekalender is either buggy or we don't know (yet),
        # if it's  buggy getting all appointments and filtering for the
        # target date is the only way forward,
        # if bugginess is undecided: let's give it a shot anyways given the
        # off-chance the user might see appointments
        return __csv_from_all_appointments(target_date = today, verbose = verbose)

Generates the KOrganizer transfer file, a .csv file with today's events.

Returns -----= KOrganizer transfer CSV file name, as created by konsolekalendar, or None. Note that the file may be empty, meaning there's no appointments.