Skip to content

Commit 7283bd3

Browse files
author
Bobrock
committed
Reduce redundant code, remove unused arguments
1 parent 63537f9 commit 7283bd3

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

reolink_api/rtsp_client.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ def __init__(self, ip: str, username: str, password: str, port: float = 554, pro
3737
self.port = port
3838
self.proxy = kwargs.get("proxies")
3939
self.url = f'rtsp://{self.username}:{self.password}@{self.ip}:{self.port}//h264Preview_01_{profile}'
40-
if use_udp:
41-
capture_options = capture_options + 'udp'
42-
else:
43-
capture_options = capture_options + 'tcp'
40+
capture_options += 'udp' if use_udp else 'tcp'
4441

4542
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = capture_options
4643

@@ -90,9 +87,6 @@ def open_stream(self):
9087
"""
9188
Opens OpenCV Video stream and returns the result according to the OpenCV documentation
9289
https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a473055e77dd7faa4d26d686226b292c1
93-
94-
:param callback: The function to callback the cv::mat frame to if required to be non-blocking. If this is left
95-
as None, then the function returns a generator which is blocking.
9690
"""
9791

9892
# Reset the capture object

reolink_api/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def modify_user(self, username: str, password: str) -> bool:
4848
r_data = self._execute_command('ModifyUser', body)[0]
4949
if r_data["value"]["rspCode"] == 200:
5050
return True
51-
print("Could not modify user:", username, "\nCamera responded with:", r_data["value"])
51+
print(f"Could not modify user: {username}\nCamera responded with: {r_data['value']}")
5252
return False
5353

5454
def delete_user(self, username: str) -> bool:
@@ -61,5 +61,5 @@ def delete_user(self, username: str) -> bool:
6161
r_data = self._execute_command('DelUser', body)[0]
6262
if r_data["value"]["rspCode"] == 200:
6363
return True
64-
print("Could not delete user:", username, "\nCamera responded with:", r_data["value"])
64+
print(f"Could not delete user: {username}\nCamera responded with: {r_data['value']}")
6565
return False

0 commit comments

Comments
 (0)