Skip to content

Commit

Permalink
Merge pull request #51 from kennybradley/master
Browse files Browse the repository at this point in the history
Adding the ability of using the RTSP profile for the stream quality
  • Loading branch information
Benehiko authored Nov 8, 2021
2 parents 02da106 + 63f2cd7 commit 5f3b6f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions reolinkapi/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def __init__(self, ip: str,
password: str = "",
https: bool = False,
defer_login: bool = False,
profile: str = "main",
**kwargs):
"""
Initialise the Camera object by passing the ip address.
Expand All @@ -23,6 +24,9 @@ def __init__(self, ip: str,
eg: {"http":"socks5://[username]:[password]@[host]:[port], "https": ...}
More information on proxies in requests: https://stackoverflow.com/a/15661226/9313679
"""
if profile not in ["main", "sub"]:
raise Exception("Profile argument must be either \"main\" or \"sub\"")

# For when you need to connect to a camera behind a proxy, pass
# a proxy argument: proxy={"http": "socks5://127.0.0.1:8000"}
APIHandler.__init__(self, ip, username, password, https=https, **kwargs)
Expand All @@ -33,6 +37,7 @@ def __init__(self, ip: str,
self.ip = ip
self.username = username
self.password = password
self.profile = profile

if not defer_login:
super().login()
2 changes: 1 addition & 1 deletion reolinkapi/mixins/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def open_video_stream(self, callback: Any = None, proxies: Any = None) -> Any:
:param proxies: Default is none, example: {"host": "localhost", "port": 8000}
"""
rtsp_client = RtspClient(
ip=self.ip, username=self.username, password=self.password, proxies=proxies, callback=callback)
ip=self.ip, username=self.username, password=self.password, profile=self.profile, proxies=proxies, callback=callback)
return rtsp_client.open_stream()

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

0 comments on commit 5f3b6f9

Please sign in to comment.