diff --git a/scripts/utils.py b/scripts/utils.py index 7b6ea69..29ac6d8 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -1,3 +1,4 @@ +import re from datetime import datetime from typing import Dict import warnings @@ -29,6 +30,14 @@ def get_week(d=datetime.today()): return (int(d.strftime("%W")) + 52 - 5) % 52 +def parse_zoom_link(browser_join_link: str): + match = re.search(r'(?:/j/|&confno=)(?P\d*)(?:&zc=0)?(?:\?|&)pwd=(?P.*?)(?:#success|$)', browser_join_link) + if not match: + return None + else: + return match.groupdict()['confno'], match.groupdict()['pwd'] + + def merge_dictionaries(main: Dict, fallback: Dict): merged = main for key in fallback.keys(): diff --git a/scripts/window_subprocess.py b/scripts/window_subprocess.py index e34c494..aef63d9 100644 --- a/scripts/window_subprocess.py +++ b/scripts/window_subprocess.py @@ -22,3 +22,15 @@ def open_pdf(filepath: Path): stderr=subprocess.DEVNULL ) return result.returncode + + +def open_zoom(confno: int, pwd_hash: str = None): + subprocess.Popen( + ["zoom", + "zoomtg://zoom.us/join?browser=chrom&confno={confno}&zc=0{pwd}".format( + confno=confno, + pwd='&pwd={}'.format(pwd_hash) if pwd_hash is not None else '') + ], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL + )