time_str = resp.info().get('Date')
time = None
if time_str:
- print(time_str)
try:
time = datetime.datetime.strptime(time_str, '%a, %d %b %Y %H:%M:%S %Z')
except ValueError:
if __name__ == '__main__':
import argparse
import contextlib
+ import os
import pathlib
import time
import urllib.parse
import urllib.request
+ import toml
+
ap = argparse.ArgumentParser()
ap.add_argument("base_path")
- ap.add_argument("url")
+ ap.add_argument("endpoint")
args = ap.parse_args()
base_path = pathlib.Path(args.base_path)
assert base_path.is_dir()
- url = args.url
- url_path = pathlib.PurePosixPath(urllib.parse.urlparse(url).path)
- endpoint = url_path.stem
+ cfg_path = (
+ pathlib.Path(
+ os.getenv('XDG_CONFIG_HOME', os.getenv('HOME') + '/.config')
+ )
+ .joinpath('oberlin_webcast2')
+ )
+ with cfg_path.joinpath('config.toml').open() as f:
+ config = toml.load(f)
+
+ endpoint = args.endpoint
+ url = config['endpoints'][endpoint]
# Follow redirects but don't throw on 4XX
opener = urllib.request.OpenerDirector()
setup(
name = "hls_watch",
- version = "0.0.0",
+ version = "0.1.0",
packages = find_packages(),
- install_requires = [],
+ install_requires = [
+ 'toml<1', 'toml>=0.10',
+ ],
)