fix: extract Teams URL via regex to support 'Teilnahmeinfos kopieren' format
This commit is contained in:
parent
83642b2b8d
commit
3a993bc741
19
main.py
19
main.py
@ -10,10 +10,13 @@ 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 platform
|
import platform
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
_TEAMS_URL_RE = re.compile(r'https://teams(?:\.live)?\.microsoft\.com/\S+')
|
||||||
|
|
||||||
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
||||||
|
|
||||||
from playwright.sync_api import sync_playwright
|
from playwright.sync_api import sync_playwright
|
||||||
@ -44,17 +47,23 @@ def _read_clipboard() -> str:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_teams_url(text: str) -> str | None:
|
||||||
|
m = _TEAMS_URL_RE.search(text)
|
||||||
|
return m.group(0) if m else None
|
||||||
|
|
||||||
|
|
||||||
def _get_meeting_url() -> str | None:
|
def _get_meeting_url() -> str | None:
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
url = sys.argv[1].strip()
|
url = _extract_teams_url(sys.argv[1])
|
||||||
if "teams.microsoft.com" in url or "teams.live.com" in url:
|
if url:
|
||||||
print(f"Meeting-URL aus Argument: {url[:60]}...")
|
print(f"Meeting-URL aus Argument: {url[:60]}...")
|
||||||
return url
|
return url
|
||||||
|
|
||||||
clip = _read_clipboard()
|
clip = _read_clipboard()
|
||||||
if "teams.microsoft.com" in clip or "teams.live.com" in clip:
|
url = _extract_teams_url(clip)
|
||||||
print(f"Meeting-URL aus Clipboard: {clip[:60]}...")
|
if url:
|
||||||
return clip
|
print(f"Meeting-URL aus Clipboard: {url[:60]}...")
|
||||||
|
return url
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user