diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 327c928..807789e 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -12,20 +12,21 @@ if hasattr(sys, 'ps1'): else: debug = False -# This works for one file: -timelog = pd.read_csv(settings.pomodoro_logfile()) +if settings.pomodoro_logfile(): + # This works for one file: + timelog = pd.read_csv(settings.pomodoro_logfile()) +else: + # For multiple files: + path = settings.pomodoro_logpath() + all_files = glob.glob(path + "*.csv") -# For multiple files: -#path = settings.pomodoro_logpath() -#all_files = glob.glob(path + "*.csv") -# -#li = [] -# -#for filename in all_files: -# df = pd.read_csv(filename, index_col=None, header=0) -# li.append(df) + li = [] -# timelog = pd.concat(li, axis=0, ignore_index=True) + for filename in all_files: + df = pd.read_csv(filename, index_col=None, header=0) + li.append(df) + + timelog = pd.concat(li, axis=0, ignore_index=True) if debug: imported = copy.deepcopy(timelog)