Skip to content

Commit 5f3b6f9

Browse files
authored
Merge pull request #51 from kennybradley/master
Adding the ability of using the RTSP profile for the stream quality
2 parents 02da106 + 63f2cd7 commit 5f3b6f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

reolinkapi/camera.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def __init__(self, ip: str,
88
password: str = "",
99
https: bool = False,
1010
defer_login: bool = False,
11+
profile: str = "main",
1112
**kwargs):
1213
"""
1314
Initialise the Camera object by passing the ip address.
@@ -23,6 +24,9 @@ def __init__(self, ip: str,
2324
eg: {"http":"socks5://[username]:[password]@[host]:[port], "https": ...}
2425
More information on proxies in requests: https://stackoverflow.com/a/15661226/9313679
2526
"""
27+
if profile not in ["main", "sub"]:
28+
raise Exception("Profile argument must be either \"main\" or \"sub\"")
29+
2630
# For when you need to connect to a camera behind a proxy, pass
2731
# a proxy argument: proxy={"http": "socks5://127.0.0.1:8000"}
2832
APIHandler.__init__(self, ip, username, password, https=https, **kwargs)
@@ -33,6 +37,7 @@ def __init__(self, ip: str,
3337
self.ip = ip
3438
self.username = username
3539
self.password = password
40+
self.profile = profile
3641

3742
if not defer_login:
3843
super().login()

reolinkapi/mixins/stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def open_video_stream(self, callback: Any = None, proxies: Any = None) -> Any:
2323
:param proxies: Default is none, example: {"host": "localhost", "port": 8000}
2424
"""
2525
rtsp_client = RtspClient(
26-
ip=self.ip, username=self.username, password=self.password, proxies=proxies, callback=callback)
26+
ip=self.ip, username=self.username, password=self.password, profile=self.profile, proxies=proxies, callback=callback)
2727
return rtsp_client.open_stream()
2828

2929
def get_snap(self, timeout: float = 3, proxies: Any = None) -> Optional[Image]:

0 commit comments

Comments
 (0)