added code to initialize db with models and recodres
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Recorder Adapter for SMP
|
||||
"""
|
||||
import logging
|
||||
|
||||
from backend import LrcException
|
||||
@@ -6,7 +9,7 @@ from backend.tools.exception_decorator import exception_decorator
|
||||
|
||||
logger = logging.getLogger("lrc.recorder_adapters.extron_smp")
|
||||
|
||||
RECORDER_MODEL_NAME = "SMP 351 / 352"
|
||||
RECORDER_MODEL_NAME = "Recorder Adapter for SMP 351 and 352"
|
||||
VERSION = "0.9.0"
|
||||
REQUIRES_USER = False
|
||||
REQUIRES_PW = True
|
||||
@@ -19,14 +22,14 @@ HOST = "129.13.51.109" # Hertz
|
||||
|
||||
USER = "admin"
|
||||
PW = "123mzsmp"
|
||||
#PW = "audimaxsmp"
|
||||
# PW = "audimaxsmp"
|
||||
PW = "smphertz"
|
||||
|
||||
|
||||
class SMP(TelnetAdapter, RecorderAdapter):
|
||||
class SMP35x(TelnetAdapter, RecorderAdapter):
|
||||
def __init__(self, address, password, auto_login=True, **kwargs):
|
||||
super().__init__(address)
|
||||
self.admin_pw = password
|
||||
RecorderAdapter.__init__(self, address, "", password)
|
||||
TelnetAdapter.__init__(self, address)
|
||||
if auto_login:
|
||||
self._login()
|
||||
|
||||
@@ -40,7 +43,7 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
raise LrcException(str(e))
|
||||
self.tn.read_until("\r\nPassword:")
|
||||
# password = getpass.getpass()
|
||||
password = self.admin_pw
|
||||
password = self.password
|
||||
self.tn.write(password + "\n\r")
|
||||
|
||||
out = self.tn.assert_string_in_output("Login Administrator")
|
||||
@@ -51,10 +54,10 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
# TODO: loop until logged in...
|
||||
logger.warning("Could not login (as admin) with given password! {}".format(self.address))
|
||||
print("re-enter pw")
|
||||
self.tn.write(self.admin_pw+"\n\r")
|
||||
self.tn.write(self.password + "\n\r")
|
||||
print(self.tn.assert_string_in_output("Login Administrator"))
|
||||
print("WRONG (admin) password!! Exiting!")
|
||||
print(self.admin_pw)
|
||||
print(self.password)
|
||||
self.tn = None
|
||||
logger.error("Could definitely not login (as admin) with given password! {}".format(self.address))
|
||||
raise Exception("Could not login as administrator with given pw!")
|
||||
@@ -725,6 +728,11 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
some advanced options skipped
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def get_recorder_params(cls) -> dict:
|
||||
return {'_requires_user': False,
|
||||
'_requires_password': True}
|
||||
|
||||
def get_input_hdcp_status(self, input_number: int):
|
||||
"""
|
||||
returns:
|
||||
@@ -783,9 +791,8 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
return TelnetAdapter._get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
smp = SMP(HOST, PW, True)
|
||||
smp = SMP35x(HOST, PW, True)
|
||||
|
||||
print(smp)
|
||||
print(smp.get_recording_status())
|
||||
@@ -833,6 +840,6 @@ def main():
|
||||
print(smp.unmute_output(2))
|
||||
print(smp.is_muted(2))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user