diff --git a/src/pyvtt/voice_to_text_tray.py b/src/pyvtt/voice_to_text_tray.py index f2bf2ca..c86a042 100755 --- a/src/pyvtt/voice_to_text_tray.py +++ b/src/pyvtt/voice_to_text_tray.py @@ -100,9 +100,17 @@ class WhisperWorker(QThread): today = datetime.date.today().strftime("%Y.%m.%d") journal_path = os.path.join(CONFIGURATION["journal_path"], f"{today} - {CURRENT_PRESET['journal_name']}.md") now = datetime.datetime.now().strftime("%H:%M") + if not os.path.exists(journal_path): + try: + with open(journal_path, "w") as f: + f.write(f"# {CURRENT_PRESET['journal_name']} - {today}\n\n") + except Exception as e: + print(f"Journal Erstellungsfehler: {e}") + notify("Fehler", "Ein Fehler beim Erstellen des Journals ist aufgetreten!") + return try: with open(journal_path, "a") as f: - f.write(f"## {now}\n") + f.write(f"## {now} Uhr\n") f.write(f"{formatted_result}\n\n") except Exception as e: print(f"Journal Fehler: {e}")