allow overriding activity type from CLI
This commit is contained in:
parent
eec4dcf1de
commit
34c7a823ad
@ -41,6 +41,8 @@ if __name__ == "__main__":
|
|||||||
'-D', '--description', help="Activity description on Garmin Connect.")
|
'-D', '--description', help="Activity description on Garmin Connect.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-P', '--private', action='store_true', help="Make activity private on Garmin Connect.")
|
'-P', '--private', action='store_true', help="Make activity private on Garmin Connect.")
|
||||||
|
parser.add_argument(
|
||||||
|
'-T', '--type', help="Override activity type (running, cycling, walking, hiking, strength_training, etc.)")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--log-level", metavar="LEVEL", type=str,
|
"--log-level", metavar="LEVEL", type=str,
|
||||||
help=("Desired log output level (DEBUG, INFO, WARNING, ERROR). "
|
help=("Desired log output level (DEBUG, INFO, WARNING, ERROR). "
|
||||||
@ -61,9 +63,9 @@ if __name__ == "__main__":
|
|||||||
for activity in args.activity:
|
for activity in args.activity:
|
||||||
log.info("uploading activity file {} ...".format(activity.name))
|
log.info("uploading activity file {} ...".format(activity.name))
|
||||||
try:
|
try:
|
||||||
id = client.upload_activity(activity, name=args.name, description=args.description, private=args.private)
|
id = client.upload_activity(activity, name=args.name, description=args.description, private=args.private, activity_type=args.type)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("upload failed: {}".format(e))
|
log.error("upload failed: {!r}".format(e))
|
||||||
else:
|
else:
|
||||||
log.info("upload successful: https://connect.garmin.com/modern/activity/{}".format(id))
|
log.info("upload successful: https://connect.garmin.com/modern/activity/{}".format(id))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user