exception decorator and mail send for errors and changes to rec state checker
This commit is contained in:
@@ -2,8 +2,9 @@ import logging
|
||||
|
||||
from backend import LrcException
|
||||
from backend.recorder_adapters import telnetlib, TelnetAdapter, RecorderAdapter
|
||||
from backend.tools.exception_decorator import exception_decorator
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger = logging.getLogger("lrc.recorder_adapters.extron_smp")
|
||||
|
||||
RECORDER_MODEL_NAME = "SMP 351 / 352"
|
||||
VERSION = "0.9.0"
|
||||
@@ -28,11 +29,13 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
self._login()
|
||||
|
||||
def _login(self):
|
||||
print("Connecting to {} ...".format(self.address))
|
||||
logger.info("Connecting to {} ...".format(self.address))
|
||||
try:
|
||||
self.tn = telnetlib.Telnet(self.address)
|
||||
except TimeoutError as e:
|
||||
raise LrcException(str(e))
|
||||
except ConnectionRefusedError as e:
|
||||
raise LrcException(str(e))
|
||||
self.tn.read_until("\r\nPassword:")
|
||||
# password = getpass.getpass()
|
||||
password = self.admin_pw
|
||||
@@ -371,6 +374,7 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
self.tn.write("{}Y2RCDR\n".format(self.esc_char))
|
||||
return TelnetAdapter._get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
@exception_decorator(ConnectionError)
|
||||
def get_recording_status(self):
|
||||
"""
|
||||
Status may be one of:
|
||||
|
||||
Reference in New Issue
Block a user