From aa7055a64817944dd6102b7650db2897b98a79d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bellec?= Date: Fri, 8 Dec 2017 19:09:48 +0100 Subject: [PATCH] Update GoProCamera.py modified infoCamera function to return parsed data #an error is raised in take_photo if no value is returned --- goprocam/GoProCamera.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/goprocam/GoProCamera.py b/goprocam/GoProCamera.py index 52c5322..c4be87d 100644 --- a/goprocam/GoProCamera.py +++ b/goprocam/GoProCamera.py @@ -230,6 +230,7 @@ def infoCamera(self, option=""): info=urllib.request.urlopen('http://10.5.5.9/gp/gpControl', timeout=5) data = info.read() encoding = info.info().get_content_charset('utf-8') + parse_read = json.loads(data.decode(encoding)) parsed_info = "" if option == "": @@ -250,6 +251,7 @@ def infoCamera(self, option=""): data = info.read() parsed=re.sub(r'\W+', '', str(data)) print(parsed) + return parsed #an error is raised in take_photo if no value is returned except (HTTPError, URLError) as error: return "" print("Error code:" + str(error.code) + "\nMake sure the connection to the WiFi camera is still active.") @@ -262,6 +264,7 @@ def infoCamera(self, option=""): data = info.read() parsed=re.sub(r'\W+', '', str(data)) print(parsed) + return parsed #an error is raised in take_photo if no value is returned except (HTTPError, URLError) as error: return "" print("Error code:" + str(error.code) + "\nMake sure the connection to the WiFi camera is still active.") @@ -1035,4 +1038,4 @@ def overview(self): print("current timelapse interval: " + self.parse_value(constants.Hero3Status.TimeLapseInterval,self.getStatus(constants.Hero3Status.TimeLapseInterval))) print("current video Fov: " + self.parse_value(constants.Hero3Status.FOV,self.getStatus(constants.Hero3Status.FOV))) print("status lights: " + self.parse_value(constants.Hero3Status.LED,self.getStatus(constants.Hero3Status.LED))) - print("recording: " + self.parse_value(constants.Hero3Status.IsRecording,self.getStatus(constants.Hero3Status.IsRecording))) \ No newline at end of file + print("recording: " + self.parse_value(constants.Hero3Status.IsRecording,self.getStatus(constants.Hero3Status.IsRecording)))