added logging conf and now checking recording status with simple script ; notifications are missing

This commit is contained in:
Tobias Kurze
2019-11-13 08:19:39 +01:00
parent 4563e16137
commit 872e531ef5
7 changed files with 436 additions and 265 deletions

View File

@@ -19,7 +19,10 @@ PW = "lrgrashof+-"
class EpiphanV1(RecorderAdapter):
def __init__(self, admin_user: str, admin_pw: str):
def __init__(self, url: str, admin_user: str, admin_pw: str):
if not url.startswith('http'):
url = 'http://' + url
self.url = url
self.user = admin_user
self.password = admin_pw
self.session = requests.Session()
@@ -32,13 +35,13 @@ class EpiphanV1(RecorderAdapter):
pass
def get_status(self) -> dict:
res = self.session.get(BASE_URL + "/admin/ajax/recorder_status.cgi")
res = self.session.get(self.url + "/admin/ajax/recorder_status.cgi")
if res.ok:
return res.json()
raise LrcException(res.text, res.status_code)
def get_sysinfo(self) -> dict:
res = self.session.get(BASE_URL + "/ajax/sysinfo.cgi")
res = self.session.get(self.url + "/ajax/sysinfo.cgi")
if res.ok:
return res.json()
raise LrcException(res.text, res.status_code)
@@ -55,13 +58,13 @@ class EpiphanV1(RecorderAdapter):
return self.get_status().get('seconds', None)
def start_recording(self):
res = self.session.get(BASE_URL + "/admin/ajax/start_recorder.cgi")
res = self.session.get(self.url + "/admin/ajax/start_recorder.cgi")
if not res.ok:
raise LrcException(res.text, res.status_code)
time.sleep(2) # just a little bit of waiting time -> it takes a bit for the Epiphan to update its state
def stop_recording(self):
res = self.session.get(BASE_URL + "/admin/ajax/stop_recorder.cgi")
res = self.session.get(self.url + "/admin/ajax/stop_recorder.cgi")
if not res.ok:
raise LrcException(res.text, res.status_code)
time.sleep(4) # just a little bit of waiting time -> it takes a bit for the Epiphan to update its state
@@ -106,7 +109,7 @@ class EpiphanV1(RecorderAdapter):
raise LrcException(str(err))
def get_screenshot(self):
ret = self.session.get(BASE_URL + "/admin/grab_frame.cgi?size=256x192&device=DAV93133.vga&_t=1573471990578",
ret = self.session.get(self.url + "/admin/grab_frame.cgi?size=256x192&device=DAV93133.vga&_t=1573471990578",
stream=True)
print(ret)
@@ -117,7 +120,7 @@ class EpiphanV1(RecorderAdapter):
if __name__ == '__main__':
e = EpiphanV1(USER, PW)
e = EpiphanV1(BASE_URL, USER, PW)
try:
# print(e.is_recording())
"""