Skip to content

Commit 2762c09

Browse files
committed
Added GA to improve features
1 parent a2e38c8 commit 2762c09

8 files changed

Lines changed: 39 additions & 2 deletions

File tree

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
def get_version() -> str:
5-
return "0.1.34"
6-
5+
return "0.1.35"
76

87
install_requires = [
98
"requests",

src/sharpai_hub/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
from argparse import ArgumentParser
5+
from sharpai_hub.utils.debughelper import event
56
from sharpai_hub.commands.user import UserCommands
67
from sharpai_hub.commands.device import DeviceCommands
78
from sharpai_hub.commands.deepcamera import DeepCameraCommands
@@ -32,6 +33,7 @@ def main():
3233

3334
if not hasattr(args, "func"):
3435
parser.print_help()
36+
event('wrong command format')
3537
exit(1)
3638

3739
# Run

src/sharpai_hub/commands/deepcamera.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from . import BaseSharpAICLICommand
99
from ..sharpai_api import SharpAIFolder,SA_API
10+
from ..utils.debughelper import event
1011
from ..utils.check_env import check_environment, get_docker_compose_arch_filename
1112

1213
class DeepCameraCommands(BaseSharpAICLICommand):
@@ -76,6 +77,7 @@ def run(self):
7677
print('Starting DeepCamera with docker-compose')
7778
args = [self.docker_compose_path, '-f' , yml_path,'up']
7879
subprocess.Popen( args= args, cwd=self.runtime_folder)
80+
event('deepcamera start')
7981

8082
class DeepCameraStopCommand(BaseDeepCameraCommands):
8183
def run(self):

src/sharpai_hub/commands/falldetection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from shutil import which
77

88
from . import BaseSharpAICLICommand
9+
10+
from ..utils.debughelper import event
911
from ..sharpai_api import SharpAIFolder,SA_API
1012
from ..utils.check_env import check_environment, get_docker_compose_arch_filename
1113

@@ -77,6 +79,7 @@ def run(self):
7779
print('Starting DeepCamera with docker-compose')
7880
args = [self.docker_compose_path, '-f' , yml_path,'up']
7981
subprocess.Popen( args= args, cwd=self.runtime_folder)
82+
event('fall detection start')
8083

8184
class FallDetectionStopCommand(BaseFallDetectionCommands):
8285
def run(self):

src/sharpai_hub/commands/screen_monitor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ..sharpai_api import SA_API
1212
from ..utils.check_env import check_environment, get_docker_compose_arch_filename
1313
from ..utils.screen_capture import screen_capture
14+
from ..utils.debughelper import event
1415
from ..utils.labelstudio import check_label_studio_access,create_labelstudio_image_classification_project
1516

1617
class ScreenMonitorCommands(BaseSharpAICLICommand):
@@ -169,6 +170,7 @@ def run(self):
169170
subprocess.Popen(args= args, cwd=self.runtime_folder, stdout=log_handle, stderr=log_handle)
170171

171172
print('Starting screen monitor')
173+
event('screen monitor start')
172174
self.start_screen_capture()
173175

174176
class ScreenMonitorStopCommand(BaseScreenMonitorCommands):

src/sharpai_hub/commands/yoloparking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from shutil import which
77

88
from . import BaseSharpAICLICommand
9+
from ..utils.debughelper import event
910
from ..sharpai_api import SharpAIFolder,SA_API
1011
from ..utils.check_env import check_environment, get_docker_compose_arch_filename
1112

@@ -77,6 +78,7 @@ def run(self):
7778
print('Starting DeepCamera with docker-compose')
7879
args = [self.docker_compose_path, '-f' , yml_path,'up']
7980
subprocess.Popen( args= args, cwd=self.runtime_folder)
81+
event('yoloparking start')
8082

8183
class YoloParkingStopCommand(BaseYoloParkingCommands):
8284
def run(self):

src/sharpai_hub/commands/yolov7_reid.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ..sharpai_api import SA_API
1313
from ..utils.check_env import check_environment, get_docker_compose_arch_filename
1414
from ..utils.screen_capture import screen_capture
15+
from ..utils.debughelper import event
1516
from ..utils.labelstudio import check_label_studio_access,create_labelstudio_image_classification_project
1617

1718
class Yolov7ReIDCommands(BaseSharpAICLICommand):
@@ -186,10 +187,13 @@ def run(self):
186187
print('Starting service')
187188

188189
if self.first_run:
190+
event('yolov7_reid first run')
189191
print('Please follow the instruction to setup Home-Assistant: https://github.com/SharpAI/DeepCamera/blob/master/docs/connect_to_ha.md')
190192
time.sleep(3)
191193
webbrowser.open('https://github.com/SharpAI/DeepCamera/blob/master/docs/connect_to_ha.md')
192194

195+
event('yolov7_reid started')
196+
193197
class Yolov7ReIDStopCommand(BaseYolov7ReIDCommands):
194198
def run(self):
195199
check_environment()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import requests
3+
from .get_id import get_id
4+
5+
GA_TRACKING_ID = 'UA-238868007-1'
6+
def event(event_to_send):
7+
try:
8+
data = {
9+
'v': '1', # API Version.
10+
'tid': GA_TRACKING_ID, # Tracking ID / Property ID.
11+
# Anonymous Client Identifier. Ideally, this should be a UUID that
12+
# is associated with particular user, device, or browser instance.
13+
'cid': get_id(),
14+
't': 'event', # Event hit type.
15+
'ec': 'Log', # Event category.
16+
'ea': event_to_send, # Event action.
17+
'ua': 'Python3'
18+
}
19+
response = requests.post('https://www.google-analytics.com/collect', data=data)
20+
except Exception as e:
21+
pass
22+
if __name__ == '__main__':
23+
event('test')

0 commit comments

Comments
 (0)