add option for parsing and opening zoom links

This commit is contained in:
Maximilian Keßler 2021-10-11 10:11:10 +02:00
parent 0d7d1cc2f3
commit 8cf70e724d
2 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,4 @@
import re
from datetime import datetime from datetime import datetime
from typing import Dict from typing import Dict
import warnings import warnings
@ -29,6 +30,14 @@ def get_week(d=datetime.today()):
return (int(d.strftime("%W")) + 52 - 5) % 52 return (int(d.strftime("%W")) + 52 - 5) % 52
def parse_zoom_link(browser_join_link: str):
match = re.search(r'(?:/j/|&confno=)(?P<confno>\d*)(?:&zc=0)?(?:\?|&)pwd=(?P<pwd>.*?)(?:#success|$)', browser_join_link)
if not match:
return None
else:
return match.groupdict()['confno'], match.groupdict()['pwd']
def merge_dictionaries(main: Dict, fallback: Dict): def merge_dictionaries(main: Dict, fallback: Dict):
merged = main merged = main
for key in fallback.keys(): for key in fallback.keys():

View file

@ -22,3 +22,15 @@ def open_pdf(filepath: Path):
stderr=subprocess.DEVNULL stderr=subprocess.DEVNULL
) )
return result.returncode 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
)