feat: --history flag to include existing messages at script start
This commit is contained in:
parent
6e06d624df
commit
47f8b44330
18
main.py
18
main.py
@ -2,13 +2,14 @@
|
|||||||
"""TeamPulse — Teams meeting chat audit tool.
|
"""TeamPulse — Teams meeting chat audit tool.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
.venv/bin/python main.py [meeting-url]
|
.venv/bin/python main.py [--history]
|
||||||
|
|
||||||
|
--history Auch bestehende Chat-Nachrichten auswerten (Standard: nur neue ab Scriptstart)
|
||||||
|
|
||||||
If no URL is given, the clipboard is checked for a Teams meeting link.
|
|
||||||
If neither yields a URL, navigate manually in the browser window.
|
|
||||||
Post !start "Presenter Name" and !stop in the chat to define a time window.
|
Post !start "Presenter Name" and !stop in the chat to define a time window.
|
||||||
A Markdown memo is saved to the current directory when the window closes.
|
A Markdown memo is saved to the current directory when the window closes.
|
||||||
"""
|
"""
|
||||||
|
import argparse
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -69,6 +70,15 @@ def _get_meeting_url() -> str | None:
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="TeamPulse — Teams Chat Auswertung")
|
||||||
|
parser.add_argument(
|
||||||
|
"--history",
|
||||||
|
action="store_true",
|
||||||
|
help="Bestehende Nachrichten auswerten (Standard: nur neue ab Scriptstart)",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
include_history: bool = args.history
|
||||||
|
|
||||||
meeting_url = _get_meeting_url()
|
meeting_url = _get_meeting_url()
|
||||||
|
|
||||||
with sync_playwright() as playwright:
|
with sync_playwright() as playwright:
|
||||||
@ -109,7 +119,7 @@ def main():
|
|||||||
resolver = Resolver(cache_path=CACHE_PATH, page=page)
|
resolver = Resolver(cache_path=CACHE_PATH, page=page)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
window = monitor.run_once()
|
window = monitor.run_once(skip_existing=not include_history)
|
||||||
|
|
||||||
print(f"\nLöse {len(window.entries)} E-Mail-Adresse(n) auf...")
|
print(f"\nLöse {len(window.entries)} E-Mail-Adresse(n) auf...")
|
||||||
resolved_entries = []
|
resolved_entries = []
|
||||||
|
|||||||
@ -151,11 +151,12 @@ class Monitor:
|
|||||||
))
|
))
|
||||||
return new_messages
|
return new_messages
|
||||||
|
|
||||||
def run_once(self) -> AuditWindow:
|
def run_once(self, skip_existing: bool = True) -> AuditWindow:
|
||||||
import time
|
import time
|
||||||
|
|
||||||
self.wait_for_chat()
|
self.wait_for_chat()
|
||||||
|
|
||||||
|
if skip_existing:
|
||||||
# Bestehende Nachrichten als "gesehen" markieren — nur neue ab jetzt zählen
|
# Bestehende Nachrichten als "gesehen" markieren — nur neue ab jetzt zählen
|
||||||
try:
|
try:
|
||||||
self.poll_new_messages()
|
self.poll_new_messages()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user