From cb57d488cc0a5648c4bc80cd815e66c74b6935ae Mon Sep 17 00:00:00 2001 From: Mateusz Grzywacz Date: Wed, 28 Nov 2018 16:59:51 +0100 Subject: [PATCH 1/3] Update for GoPro HERO 2018 model GoPro HERO 2018 (entry-level model) has a `firmware_version` str as `H18.01.01.00.00`. As it is a single `H` letter, we cannot use `"Hxx" in response` method anymore. Therefore I've changed it to regexp and exact comparisons. --- GoProStream.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GoProStream.py b/GoProStream.py index d04038a..97e307f 100644 --- a/GoProStream.py +++ b/GoProStream.py @@ -63,9 +63,14 @@ def gopro_live(): response_raw = urlopen('http://10.5.5.9/gp/gpControl').read().decode('utf-8') jsondata=json.loads(response_raw) response=jsondata["info"]["firmware_version"] + import re + match = re.match(r"([a-z]+)([0-9]+)", response, re.I) + if match: + model=match.groups()[0] + except http.client.BadStatusLine: response = urlopen('http://10.5.5.9/camera/cv').read().decode('utf-8') - if "HD4" in response or "HD3.2" in response or "HD5" in response or "HX" in response or "HD6" in response: + if model=="HD4" or model=="HD3.2" or model=="HD5" or model=="H" or model=="HX" or model=="HD6": print("branch HD4") print(jsondata["info"]["model_name"]+"\n"+jsondata["info"]["firmware_version"]) ## @@ -80,7 +85,7 @@ def gopro_live(): print("Recording on camera: " + str(RECORD)) ## GoPro HERO4 Session needs status 31 to be greater or equal than 1 in order to start the live feed. - if "HX" in response: + if model=="HX" or model=="H": connectedStatus=False while connectedStatus == False: req=urlopen("http://10.5.5.9/gp/gpControl/status") From a27202cda4752ff6242216482cc585e19dc07554 Mon Sep 17 00:00:00 2001 From: Mateusz Grzywacz Date: Wed, 28 Nov 2018 21:46:49 +0100 Subject: [PATCH 2/3] Update GoProStream.py model designator for HERO 2018 is H18. reduced detecting `HD3.2` to `HD3` --- GoProStream.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GoProStream.py b/GoProStream.py index d04038a..5b23dcc 100644 --- a/GoProStream.py +++ b/GoProStream.py @@ -63,9 +63,11 @@ def gopro_live(): response_raw = urlopen('http://10.5.5.9/gp/gpControl').read().decode('utf-8') jsondata=json.loads(response_raw) response=jsondata["info"]["firmware_version"] + model=response.split('.')[0] + except http.client.BadStatusLine: response = urlopen('http://10.5.5.9/camera/cv').read().decode('utf-8') - if "HD4" in response or "HD3.2" in response or "HD5" in response or "HX" in response or "HD6" in response: + if model=="HD4" or model=="HD3" or model=="HD5" or model=="H18" or model=="HX" or model=="HD6": print("branch HD4") print(jsondata["info"]["model_name"]+"\n"+jsondata["info"]["firmware_version"]) ## @@ -80,7 +82,7 @@ def gopro_live(): print("Recording on camera: " + str(RECORD)) ## GoPro HERO4 Session needs status 31 to be greater or equal than 1 in order to start the live feed. - if "HX" in response: + if model=="HX" or model=="H18": connectedStatus=False while connectedStatus == False: req=urlopen("http://10.5.5.9/gp/gpControl/status") @@ -116,7 +118,7 @@ def gopro_live(): sock.sendto(MESSAGE, (UDP_IP, UDP_PORT)) sleep(KEEP_ALIVE_PERIOD/1000) else: - print("branch hero3"+response) + print("branch hero3 "+response) if "Hero3" in response or "HERO3+" in response: print("branch hero3") PASSWORD=urlopen("http://10.5.5.9/bacpac/sd").read() From 7fa78336033b5b4f2a0bcab3873349a8cced718b Mon Sep 17 00:00:00 2001 From: Mateusz Grzywacz Date: Wed, 28 Nov 2018 21:50:10 +0100 Subject: [PATCH 3/3] Update GoProStream.py added HERO 2018 to 'supported cameras' --- GoProStream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoProStream.py b/GoProStream.py index 5b23dcc..103da6b 100644 --- a/GoProStream.py +++ b/GoProStream.py @@ -9,7 +9,7 @@ ## 3. Run this script. ## ## Supported cameras: -## GoPro HERO5 (incl. Session), HERO4 (incl. Session), HERO+, HERO3+, HERO3, HERO2 w/ WiFi BacPac. +## GoPro HERO5 (incl. Session), HERO4 (incl. Session), HERO+, HERO3+, HERO3, HERO2 w/ WiFi BacPac, HERO 2018. ## ## That's all! When done, press CTRL+C to quit this application. ##