feat: auto-detect meeting URL from argument or clipboard
This commit is contained in:
parent
72aff02a9b
commit
01785d6ddc
56
main.py
56
main.py
@ -2,12 +2,15 @@
|
|||||||
"""TeamPulse — Teams meeting chat audit tool.
|
"""TeamPulse — Teams meeting chat audit tool.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
.venv/bin/python main.py
|
.venv/bin/python main.py [meeting-url]
|
||||||
|
|
||||||
Opens a browser, navigates to Teams Web. Post !start "Presenter Name" and
|
If no URL is given, the clipboard is checked for a Teams meeting link.
|
||||||
!stop in the meeting chat to define a time window. A Markdown memo is
|
If neither yields a URL, navigate manually in the browser window.
|
||||||
saved to the current directory when the window closes.
|
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.
|
||||||
"""
|
"""
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -22,16 +25,56 @@ from teampulse.monitor import Monitor
|
|||||||
from teampulse.resolver import Resolver
|
from teampulse.resolver import Resolver
|
||||||
|
|
||||||
CACHE_PATH = Path.home() / ".teampulse" / "cache.json"
|
CACHE_PATH = Path.home() / ".teampulse" / "cache.json"
|
||||||
|
TEAMS_URL = "https://teams.microsoft.com"
|
||||||
|
|
||||||
|
|
||||||
|
def _read_clipboard() -> str:
|
||||||
|
try:
|
||||||
|
system = platform.system()
|
||||||
|
if system == "Darwin":
|
||||||
|
return subprocess.check_output(["pbpaste"]).decode("utf-8").strip()
|
||||||
|
elif system == "Linux":
|
||||||
|
return subprocess.check_output(["xclip", "-selection", "clipboard", "-o"]).decode("utf-8").strip()
|
||||||
|
elif system == "Windows":
|
||||||
|
return subprocess.check_output(
|
||||||
|
["powershell", "-command", "Get-Clipboard"], text=True
|
||||||
|
).strip()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def _get_meeting_url() -> str | None:
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
url = sys.argv[1].strip()
|
||||||
|
if "teams.microsoft.com" in url or "teams.live.com" in url:
|
||||||
|
print(f"Meeting-URL aus Argument: {url[:60]}...")
|
||||||
|
return url
|
||||||
|
|
||||||
|
clip = _read_clipboard()
|
||||||
|
if "teams.microsoft.com" in clip or "teams.live.com" in clip:
|
||||||
|
print(f"Meeting-URL aus Clipboard: {clip[:60]}...")
|
||||||
|
return clip
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
meeting_url = _get_meeting_url()
|
||||||
|
|
||||||
with sync_playwright() as playwright:
|
with sync_playwright() as playwright:
|
||||||
print("Starte Browser...")
|
print("Starte Browser...")
|
||||||
context = create_context(playwright, headless=False)
|
context = create_context(playwright, headless=False)
|
||||||
ensure_logged_in(context)
|
ensure_logged_in(context)
|
||||||
|
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
page.goto("https://teams.microsoft.com")
|
|
||||||
|
if meeting_url:
|
||||||
|
page.goto(meeting_url)
|
||||||
|
else:
|
||||||
|
page.goto(TEAMS_URL)
|
||||||
|
print("\nKeine Meeting-URL gefunden — bitte im Browser zur Chat-Seite navigieren.")
|
||||||
|
print("Tipp: Meeting-Link aus Teams kopieren, dann Skript neu starten.\n")
|
||||||
|
|
||||||
monitor = Monitor(page=page, current_user="")
|
monitor = Monitor(page=page, current_user="")
|
||||||
print("Lese eingeloggten Nutzer...")
|
print("Lese eingeloggten Nutzer...")
|
||||||
@ -39,8 +82,7 @@ def main():
|
|||||||
monitor._current_user = current_user
|
monitor._current_user = current_user
|
||||||
print(f"Eingeloggt als: {current_user}")
|
print(f"Eingeloggt als: {current_user}")
|
||||||
|
|
||||||
print("\nNavigiere im Browser zur Meeting-Chat-Seite.")
|
print("\nPoste '!start \"Name des Vortragenden\"' im Chat um zu beginnen.\n")
|
||||||
print("Poste dann '!start \"Name des Vortragenden\"' im Chat.\n")
|
|
||||||
|
|
||||||
window = monitor.run()
|
window = monitor.run()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user