Reduce redundant code, remove unused arguments
This commit is contained in:
@@ -37,10 +37,7 @@ class RtspClient:
|
||||
self.port = port
|
||||
self.proxy = kwargs.get("proxies")
|
||||
self.url = f'rtsp://{self.username}:{self.password}@{self.ip}:{self.port}//h264Preview_01_{profile}'
|
||||
if use_udp:
|
||||
capture_options = capture_options + 'udp'
|
||||
else:
|
||||
capture_options = capture_options + 'tcp'
|
||||
capture_options += 'udp' if use_udp else 'tcp'
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -48,7 +48,7 @@ class UserAPIMixin:
|
||||
r_data = self._execute_command('ModifyUser', body)[0]
|
||||
if r_data["value"]["rspCode"] == 200:
|
||||
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
|
||||
|
||||
def delete_user(self, username: str) -> bool:
|
||||
@@ -61,5 +61,5 @@ class UserAPIMixin:
|
||||
r_data = self._execute_command('DelUser', body)[0]
|
||||
if r_data["value"]["rspCode"] == 200:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user