updated urls

This commit is contained in:
Tobias K.
2023-10-24 16:16:57 +02:00
parent 884ae00574
commit 40ddd4bbeb
2 changed files with 14 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ class Config:
# SERVER_NAME = "localhost.localdomain" # SERVER_NAME = "localhost.localdomain"
# PORT = 5443 # PORT = 5443
OPENCAST_URL = "https://opencast.bibliothek.kit.edu" OPENCAST_URL = "https://oc-bib-admin.bibliothek.kit.edu"
OPENCAST_USER = "admin" OPENCAST_USER = "admin"
OPENCAST_PW = "mz.paziuw!" OPENCAST_PW = "mz.paziuw!"

View File

@@ -34,7 +34,7 @@ rec_err_state_log_stream_handler.setLevel(logging.WARNING)
logger.addHandler(rec_err_state_log_stream_handler) logger.addHandler(rec_err_state_log_stream_handler)
#logger.addHandler(mem_handler) #logger.addHandler(mem_handler)
base_url = "https://opencast.bibliothek.kit.edu" base_url = "https://oc-bib-admin.bibliothek.kit.edu"
session = requests.session() session = requests.session()
session.auth = HTTPBasicAuth(Config.OPENCAST_USER, Config.OPENCAST_PW) session.auth = HTTPBasicAuth(Config.OPENCAST_USER, Config.OPENCAST_PW)
@@ -66,6 +66,7 @@ def get_calender(rec_id):
url = get_service_url('org.opencastproject.scheduler') + "/calendars" url = get_service_url('org.opencastproject.scheduler') + "/calendars"
res = session.get(url, params=params) res = session.get(url, params=params)
if res.ok: if res.ok:
logger.debug(res.text)
return Calendar(res.text) return Calendar(res.text)
@@ -113,6 +114,9 @@ def check_capture_agent_state(a: dict):
logger.info("{} has entry in Calender and should therefore be recording... checking now!".format(a['name'])) logger.info("{} has entry in Calender and should therefore be recording... checking now!".format(a['name']))
if a['state'] == "capturing": if a['state'] == "capturing":
recorder_info = get_recorder_by_name(a['name']) recorder_info = get_recorder_by_name(a['name'])
if recorder_info is None:
logger.error("FATAL: Could not find recorder info for {}!".format(a['name']))
return
try: try:
rec = get_recorder_adapter(recorder_info) rec = get_recorder_adapter(recorder_info)
if rec.is_recording(): if rec.is_recording():
@@ -131,6 +135,9 @@ def check_capture_agent_state(a: dict):
logger.error("FATAL: {} is not in capturing state...but should be!!".format(a['name'])) logger.error("FATAL: {} is not in capturing state...but should be!!".format(a['name']))
else: else:
recorder_info = get_recorder_by_name(a['name']) recorder_info = get_recorder_by_name(a['name'])
if recorder_info is None:
logger.error("FATAL: Could not find recorder info for {}!".format(a['name']))
return
try: try:
rec = get_recorder_adapter(recorder_info) rec = get_recorder_adapter(recorder_info)
if rec.is_recording(): if rec.is_recording():
@@ -147,7 +154,11 @@ def check_capture_agent_state(a: dict):
def ping_capture_agent(a: dict): def ping_capture_agent(a: dict):
recorder_ip = get_recorder_by_name(a['name'])['ip'] logger.debug(get_recorder_by_name(a['name']))
recorder = get_recorder_by_name(a['name'])
if recorder is None:
return
recorder_ip = recorder['ip']
try: try:
response = subprocess.check_call( response = subprocess.check_call(
['ping', '-W', '10', '-c', '2', recorder_ip], ['ping', '-W', '10', '-c', '2', recorder_ip],