university-setup/scripts/links.py
2021-09-17 13:07:20 +02:00

22 lines
589 B
Python

import subprocess
from typing import Dict, List
class Links:
def __init__(self, course):
self.course = course # A course
self.info: Dict = course.info['links']
def open(self, key: str):
self.open_link_in_browser(self.info[key])
def available(self) -> List[str]:
return [key for key in self.info.keys() if self.info[key] != '']
@staticmethod
def open_link_in_browser(url):
result = subprocess.run(
['qutebrowser', str(url)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)