Reduce redundant code, remove unused arguments

This commit is contained in:
Bobrock
2020-12-18 09:12:15 -06:00
parent 63537f9daf
commit 7283bd3cab
2 changed files with 3 additions and 9 deletions

View File

@@ -37,10 +37,7 @@ class RtspClient:
self.port = port self.port = port
self.proxy = kwargs.get("proxies") self.proxy = kwargs.get("proxies")
self.url = f'rtsp://{self.username}:{self.password}@{self.ip}:{self.port}//h264Preview_01_{profile}' self.url = f'rtsp://{self.username}:{self.password}@{self.ip}:{self.port}//h264Preview_01_{profile}'
if use_udp: capture_options += 'udp' if use_udp else 'tcp'
capture_options = capture_options + 'udp'
else:
capture_options = capture_options + 'tcp'
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = capture_options os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = capture_options
@@ -90,9 +87,6 @@ class RtspClient:
""" """
Opens OpenCV Video stream and returns the result according to the OpenCV documentation Opens OpenCV Video stream and returns the result according to the OpenCV documentation
https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a473055e77dd7faa4d26d686226b292c1 https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a473055e77dd7faa4d26d686226b292c1
:param callback: The function to callback the cv::mat frame to if required to be non-blocking. If this is left
as None, then the function returns a generator which is blocking.
""" """
# Reset the capture object # Reset the capture object

View File

@@ -48,7 +48,7 @@ class UserAPIMixin:
r_data = self._execute_command('ModifyUser', body)[0] r_data = self._execute_command('ModifyUser', body)[0]
if r_data["value"]["rspCode"] == 200: if r_data["value"]["rspCode"] == 200:
return True return True
print("Could not modify user:", username, "\nCamera responded with:", r_data["value"]) print(f"Could not modify user: {username}\nCamera responded with: {r_data['value']}")
return False return False
def delete_user(self, username: str) -> bool: def delete_user(self, username: str) -> bool:
@@ -61,5 +61,5 @@ class UserAPIMixin:
r_data = self._execute_command('DelUser', body)[0] r_data = self._execute_command('DelUser', body)[0]
if r_data["value"]["rspCode"] == 200: if r_data["value"]["rspCode"] == 200:
return True return True
print("Could not delete user:", username, "\nCamera responded with:", r_data["value"]) print(f"Could not delete user: {username}\nCamera responded with: {r_data['value']}")
return False return False