From d585e397e8414ec7f95b26c3e698cf43c5df0eee Mon Sep 17 00:00:00 2001 From: Tom Goetz Date: Tue, 8 Aug 2023 12:41:05 -0400 Subject: [PATCH 1/3] update dependant package versions --- Fit | 2 +- Tcx | 2 +- dev-requirements.txt | 4 ++-- garmindb/version_info.py | 4 ++-- requirements.in | 2 +- requirements.txt | 18 +++++++++--------- utilities | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Fit b/Fit index fbe2aad..c5d81f2 160000 --- a/Fit +++ b/Fit @@ -1 +1 @@ -Subproject commit fbe2aadc115b8c8610d9c756ce30114d23cf89a5 +Subproject commit c5d81f2ad79e49245758f3c011ab1a4c36a7cbc9 diff --git a/Tcx b/Tcx index e5b5f49..5770d01 160000 --- a/Tcx +++ b/Tcx @@ -1 +1 @@ -Subproject commit e5b5f495c748374e56fdadfcf5f49cc2f63f5f66 +Subproject commit 5770d01f5d660c6eb7e49d5226368dbefb280022 diff --git a/dev-requirements.txt b/dev-requirements.txt index 555c35e..de77b56 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -flake8==6.0.0 +flake8==6.1.0 build==0.10.0 -wheel==0.38.4 +wheel==0.41.1 twine==4.0.2 diff --git a/garmindb/version_info.py b/garmindb/version_info.py index fe7c9b2..2a47bba 100644 --- a/garmindb/version_info.py +++ b/garmindb/version_info.py @@ -6,8 +6,8 @@ python_required = (3, 0, 0) -python_tested = (3, 10, 6) -version_info = (3, 3, 1) +python_tested = (3, 11, 4) +version_info = (3, 4, 0) prerelease = True diff --git a/requirements.in b/requirements.in index ee88f14..1cc2e03 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -sqlalchemy~=2.0.4 +sqlalchemy~=2.0.19 requests python-dateutil cached-property diff --git a/requirements.txt b/requirements.txt index ec9e467..5897d64 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ -SQLAlchemy~=2.0.4 -requests~=2.28.2 -python-dateutil~=2.8.2 -cached-property~=1.5.2 -tqdm~=4.64.1 -matplotlib~=3.7.0 -cloudscraper~=1.2.68 -ipykernel~=6.21.2 -ipyleaflet~=0.17.2 +SQLAlchemy==2.0.19 +requests==2.31.0 +python-dateutil==2.8.2 +cached-property==1.5.2 +tqdm==4.65.1 +matplotlib==3.7.2 +cloudscraper==1.2.71 +ipykernel==6.25.1 +ipyleaflet==0.17.3 fitfile==1.1.3 tcxfile==1.0.4 idbutils==1.0.8 diff --git a/utilities b/utilities index 44d3041..1c713ae 160000 --- a/utilities +++ b/utilities @@ -1 +1 @@ -Subproject commit 44d30412820c5f9be9e1b42258e72daa22dd17e3 +Subproject commit 1c713ae97734fd92cbad3a858dbfab4387fca9ea From 93d19ef73bd6193f48d303d99441d0d6ec9e6197 Mon Sep 17 00:00:00 2001 From: Tom Goetz Date: Tue, 8 Aug 2023 18:17:31 -0400 Subject: [PATCH 2/3] trim gitignore; update packages --- .gitignore | 6 ------ Fit | 2 +- Plugins | 2 +- Tcx | 2 +- requirements.in | 2 +- requirements.txt | 2 +- utilities | 2 +- 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 1215b63..5230f45 100644 --- a/.gitignore +++ b/.gitignore @@ -25,12 +25,6 @@ wheels/ .installed.cfg *.egg -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/Fit b/Fit index c5d81f2..f7e1d79 160000 --- a/Fit +++ b/Fit @@ -1 +1 @@ -Subproject commit c5d81f2ad79e49245758f3c011ab1a4c36a7cbc9 +Subproject commit f7e1d799e307eaa2221719530a681ef9796bf7f0 diff --git a/Plugins b/Plugins index a0299c6..cf2e482 160000 --- a/Plugins +++ b/Plugins @@ -1 +1 @@ -Subproject commit a0299c6a2ece88fcb26a31dc5f27eb38de2ebe72 +Subproject commit cf2e482ba5a051edd756355418e3426eb2673b93 diff --git a/Tcx b/Tcx index 5770d01..84e2485 160000 --- a/Tcx +++ b/Tcx @@ -1 +1 @@ -Subproject commit 5770d01f5d660c6eb7e49d5226368dbefb280022 +Subproject commit 84e2485bb432b5f2dbbcccf2c3ccc87068352a97 diff --git a/requirements.in b/requirements.in index 1cc2e03..9dfe3e3 100644 --- a/requirements.in +++ b/requirements.in @@ -7,6 +7,6 @@ matplotlib cloudscraper ipykernel ipyleaflet -fitfile>=1.1.3 +fitfile>=1.1.4 tcxfile>=1.0.4 idbutils>=1.0.8 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5897d64..87c913d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,6 @@ matplotlib==3.7.2 cloudscraper==1.2.71 ipykernel==6.25.1 ipyleaflet==0.17.3 -fitfile==1.1.3 +fitfile==1.1.4 tcxfile==1.0.4 idbutils==1.0.8 diff --git a/utilities b/utilities index 1c713ae..3767550 160000 --- a/utilities +++ b/utilities @@ -1 +1 @@ -Subproject commit 1c713ae97734fd92cbad3a858dbfab4387fca9ea +Subproject commit 376755013bb666ec54e3278b171d99f2ee182912 From 8c521a52aa54247ccfa8dc75a93ea7fa65355aa0 Mon Sep 17 00:00:00 2001 From: Tom Goetz Date: Wed, 9 Aug 2023 20:04:55 -0400 Subject: [PATCH 3/3] Update Garmin Connect activity type enums --- Makefile | 3 + garmindb/download.py | 4 +- garmindb/garmin_connect_enums.py | 109 ++++++++++++++++++------------- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 2bf539f..6999362 100644 --- a/Makefile +++ b/Makefile @@ -219,6 +219,9 @@ copy_garmin: update_garmin: garmindb_cli.py --all --download --import --analyze --latest +update_garmin_activities: + garmindb_cli.py --activities --download --import --analyze --latest + copy_garmin_latest: garmindb_cli.py --all --copy --import --analyze --latest diff --git a/garmindb/download.py b/garmindb/download.py index 31485e9..1fbd1e1 100755 --- a/garmindb/download.py +++ b/garmindb/download.py @@ -168,8 +168,8 @@ def login(self): } try: response = self.modern_rest_client.get('', params=params) - except RestException: - logger.error("Login get homepage failed (%d).", response.status_code) + except RestException as e: + logger.error("Login get homepage failed (%d) %s.", response.status_code, e) RestClient.save_binary_file('login_home.html', response) return False self.user_prefs = self.__get_json(response.text, 'VIEWER_USERPREFERENCES') diff --git a/garmindb/garmin_connect_enums.py b/garmindb/garmin_connect_enums.py index 1401310..7f9c933 100644 --- a/garmindb/garmin_connect_enums.py +++ b/garmindb/garmin_connect_enums.py @@ -116,6 +116,29 @@ class Sport(enum.Enum): skate_skiing_ws = 170 cross_country_skiing_ws = 171 resort_skiing_snowboarding_ws = 172 + indoor_climbing = 173 + bouldering = 174 + e_bike_mountain = 175 + e_bike_fitness = 176 + onshore_grinding = 178 + offshore_grinding = 179 + hiit = 180 + ultra_run = 181 + e_sport = 182 + windsurfing = 183 + kiteboarding = 184 + motorcycling_v2 = 185 + motocross_v2 = 186 + atv_v2 = 187 + transition_v2 = 189 + swimToBikeTransition_v2 = 190 + bikeToRunTransition_v2 = 191 + runToBikeTransition_v2 = 192 + hunting = 193 + fishing = 194 + whitewater_rafting = 195 + kayaking = 196 + stand_up_paddleboarding_v2 = 239 @classmethod def __activity_from_json(cls, json_data): @@ -173,46 +196,45 @@ def subsport_from_details_json(cls, json_data): def convert_gc_sport_to_fit(gc_sport, gc_sub_sport): """Convert sport and subsport values from Garmin Connect to Fit values.""" remap_gc_sub_sport_to_fit = { - Sport.mountain_biking : fitfile.SubSport.mountain, - Sport.trail_running : fitfile.SubSport.trail, - Sport.street_running : fitfile.SubSport.street, - Sport.track_running : fitfile.SubSport.track, - Sport.road_biking : fitfile.SubSport.road, - Sport.casual_walking : fitfile.SubSport.casual_walking, - Sport.speed_walking : fitfile.SubSport.speed_walking, - Sport.treadmill_running : fitfile.SubSport.treadmill, - Sport.downhill_biking : fitfile.SubSport.downhill, - Sport.track_cycling : fitfile.SubSport.track_cycling, - Sport.recumbent_cycling : fitfile.SubSport.recumbent, - Sport.indoor_cycling : fitfile.SubSport.indoor_cycling, - Sport.strength_training : fitfile.SubSport.strength_training, - Sport.cyclocross : fitfile.SubSport.cyclocross, - Sport.lap_swimming : fitfile.SubSport.lap_swimming, - Sport.open_water_swimming : fitfile.SubSport.open_water, - Sport.elliptical : fitfile.SubSport.elliptical, - Sport.stair_climbing : fitfile.SubSport.stair_climbing, - Sport.indoor_rowing : fitfile.SubSport.indoor_rowing, - Sport.bmx : fitfile.SubSport.bmx, - Sport.gravel_cycling : fitfile.SubSport.gravel_cycling, - Sport.yoga : fitfile.SubSport.yoga, - Sport.obstacle_run : fitfile.SubSport.obstacle, - Sport.indoor_running : fitfile.SubSport.indoor_running, - Sport.yoga_gym : Sport.yoga_gym + Sport.mountain_biking : fitfile.SubSport.mountain, + Sport.trail_running : fitfile.SubSport.trail, + Sport.street_running : fitfile.SubSport.street, + Sport.track_running : fitfile.SubSport.track, + Sport.road_biking : fitfile.SubSport.road, + Sport.casual_walking : fitfile.SubSport.casual_walking, + Sport.speed_walking : fitfile.SubSport.speed_walking, + Sport.treadmill_running : fitfile.SubSport.treadmill, + Sport.downhill_biking : fitfile.SubSport.downhill, + Sport.track_cycling : fitfile.SubSport.track_cycling, + Sport.recumbent_cycling : fitfile.SubSport.recumbent, + Sport.indoor_cycling : fitfile.SubSport.indoor_cycling, + Sport.strength_training : fitfile.SubSport.strength_training, + Sport.cyclocross : fitfile.SubSport.cyclocross, + Sport.indoor_cardio : fitfile.SubSport.cardio_training, + Sport.lap_swimming : fitfile.SubSport.lap_swimming, + Sport.open_water_swimming : fitfile.SubSport.open_water, + Sport.elliptical : fitfile.SubSport.elliptical, + Sport.stair_climbing : fitfile.SubSport.stair_climbing, + Sport.indoor_rowing : fitfile.SubSport.indoor_rowing, + Sport.bmx : fitfile.SubSport.bmx, + Sport.gravel_cycling : fitfile.SubSport.gravel_cycling, + Sport.yoga : fitfile.SubSport.yoga, + Sport.obstacle_run : fitfile.SubSport.obstacle, + Sport.indoor_running : fitfile.SubSport.indoor_running, + Sport.indoor_climbing : fitfile.SubSport.indoor_climbing, + Sport.bouldering : fitfile.SubSport.bouldering + } remap_winter_sports = { Sport.snow_shoe_ws : fitfile.Sport.snowshoeing, Sport.skating_ws : fitfile.Sport.ice_skating, - Sport.backcountry_skiing_snowboarding_ws : Sport.backcountry_skiing_snowboarding, - Sport.skate_skiing_ws : Sport.skate_skiing_ws, Sport.cross_country_skiing_ws : fitfile.Sport.cross_country_skiing, - Sport.resort_skiing_snowboarding_ws : Sport.resort_skiing_snowboarding } remap_gc_sport_to_fit = { Sport.running : fitfile.Sport.running, Sport.cycling : fitfile.Sport.cycling, Sport.hiking : fitfile.Sport.hiking, Sport.walking : fitfile.Sport.walking, - Sport.indoor_cardio : Sport.indoor_cardio, Sport.swimming : fitfile.Sport.swimming, Sport.fitness_equipment : fitfile.Sport.fitness_equipment, Sport.snow_shoe : fitfile.Sport.snowshoeing, @@ -223,42 +245,35 @@ def convert_gc_sport_to_fit(gc_sport, gc_sub_sport): Sport.driving_general : fitfile.Sport.driving, Sport.flying : fitfile.Sport.flying, Sport.paddling : fitfile.Sport.paddling, - Sport.whitewater_rafting_kayaking : Sport.whitewater_rafting_kayaking, Sport.skating : fitfile.Sport.ice_skating, Sport.inline_skating : fitfile.Sport.inline_skating, - Sport.resort_skiing_snowboarding : Sport.resort_skiing_snowboarding, - Sport.backcountry_skiing_snowboarding : Sport.backcountry_skiing_snowboarding, Sport.boating : fitfile.Sport.boating, Sport.sailing : fitfile.Sport.sailing, Sport.cross_country_skiing : fitfile.Sport.cross_country_skiing, Sport.stand_up_paddleboarding : fitfile.Sport.stand_up_paddleboarding, Sport.golf : fitfile.Sport.golf, - Sport.hunting_fishing : Sport.hunting_fishing, Sport.surfing : fitfile.Sport.surfing, Sport.wakeboarding : fitfile.Sport.wakeboarding, Sport.rock_climbing : fitfile.Sport.rock_climbing, Sport.hang_gliding : fitfile.Sport.hang_gliding, Sport.tennis : fitfile.Sport.tennis, - Sport.diving : Sport.diving, Sport.floor_climbing : fitfile.Sport.floor_climbing, - Sport.virtual_ride : Sport.virtual_ride, - Sport.virtual_run : Sport.virtual_run, - Sport.safety : Sport.safety, - Sport.assistance : Sport.assistance, - Sport.incident_detected : Sport.incident_detected, - Sport.ccr_diving : Sport.ccr_diving, - Sport.auto_racing : Sport.auto_racing, - Sport.breathwork : Sport.breathwork, - Sport.other : Sport.other + Sport.windsurfing : fitfile.Sport.windsurfing, + Sport.kiteboarding : fitfile.Sport.kitesurfing, + Sport.hunting : fitfile.Sport.hunting, + Sport.fishing : fitfile.Sport.fishing, + Sport.whitewater_rafting : fitfile.Sport.rafting, + Sport.kayaking : fitfile.Sport.kayaking, + Sport.stand_up_paddleboarding_v2 : fitfile.Sport.stand_up_paddleboarding } special_remaps = { - Sport.other : remap_gc_sport_to_fit.get(gc_sub_sport), - Sport.top_level : remap_gc_sport_to_fit.get(gc_sub_sport), - Sport.winter_sports : remap_winter_sports.get(gc_sub_sport) + Sport.other : remap_gc_sport_to_fit.get(gc_sub_sport, gc_sub_sport), + Sport.top_level : remap_gc_sport_to_fit.get(gc_sub_sport, gc_sub_sport), + Sport.winter_sports : remap_winter_sports.get(gc_sub_sport, gc_sub_sport) } if gc_sport in special_remaps.keys(): return (special_remaps[gc_sport], fitfile.Sport.generic) - return (remap_gc_sport_to_fit.get(gc_sport), remap_gc_sub_sport_to_fit.get(gc_sub_sport)) + return (remap_gc_sport_to_fit.get(gc_sport, gc_sport), remap_gc_sub_sport_to_fit.get(gc_sub_sport, gc_sub_sport)) def get_details_sport(json_data):