Command line interface¶
A command line interface (CLI) is available to manage database, OAuth2 tokens, users and workouts archive uploads.
$ ftcli
Usage: ftcli [OPTIONS] COMMAND [ARGS]...
FitTrackee Command Line Interface
Options:
--help Show this message and exit.
Commands:
db Manage database.
oauth2 Manage OAuth2 tokens.
users Manage users.
workouts Manage workouts.
Database¶
ftcli db drop¶
Added in version 0.6.5.
Empty database and delete uploaded files, only on development environments.
ftcli db upgrade¶
Added in version 0.6.5.
Apply migrations.
OAuth2¶
ftcli oauth2 clean¶
Added in version 0.7.0.
Remove tokens expired for more than provided number of days
Options |
Description |
|---|---|
|
Number of days. |
Users¶
ftcli users clean_archives¶
Added in version 0.7.13.
Delete export requests and related archives created more than provided number of days.
Options |
Description |
|---|---|
|
Number of days. |
ftcli users clean_tokens¶
Added in version 0.7.0.
Remove blacklisted tokens expired for more than provided number of days.
Options |
Description |
|---|---|
|
Number of days. |
ftcli users create¶
Added in version 0.7.15.
Changed in version 0.8.4: User preference for interface language is added.
Changed in version 0.9.0: Add option for user role.
Changed in version 0.9.4: User preference for timezone is added.
Create a user account.
Note
the newly created account is already active.
the CLI allows to create users when registration is disabled.
Arguments/options |
Description |
|---|---|
|
Username. |
|
User email (mandatory). |
|
User password (if not provided, a random password is generated). |
|
User preference for interface language (two-letter code, ISO 639-1). If not provided or not supported, it falls back to English (‘en’). |
|
User preference for timezone. If not provided or not supported, it falls back to ‘Europe/Paris’. |
|
User role (default: ‘user’). |
ftcli users export_archive¶
Added in version 0.10.0.
Process a given queued user data export.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
|---|---|
|
Id of task to process. |
ftcli users export_archives¶
Added in version 0.7.13.
Process incomplete user export requests.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
|---|---|
|
Maximum number of export requests to process. |
ftcli users update¶
Added in version 0.6.5.
Changed in version 0.9.0: Add --set-role option. --set-admin is now deprecated.
Changed in version 1.0.0: Remove --set-admin option.
Modify a user account (role, active status, email and password).
Arguments/options |
Description |
|---|---|
|
Username. |
|
Set user role (when setting ‘moderator’, ‘admin’ and ‘owner’ role, it also activates user account if not active). |
|
Activate user account. |
|
Reset user password (a new password will be displayed). |
|
New user email. |
Workouts¶
ftcli workouts archive_upload¶
Added in version 0.10.0.
Process a given queued workouts archive upload.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
|---|---|
|
Id of task to process. |
ftcli workouts archive_uploads¶
Added in version 0.10.0.
Process workouts archive uploads if queued tasks exist (progress = 0 and not aborted/errored).
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
|---|---|
|
Maximum number of workouts archive to process. |
ftcli workouts refresh¶
Added in version 0.12.0.
Changed in version 1.0.0: Add --add-missing-geometry option.
Changed in version 1.0.7: Add --on-file-error option.
Changed in version 1.1.0: Remove --add-missing-geometry option and add --with-elevation and --new-sport-id options.
Changed in version 1.1.1: Add --without-file option.
This command allows to refresh:
workouts with file, by recalculating data from original file, fetching weather data if weather provider is set and workout does not have weather data and fetching missing elevation if elevation provider is set.
workouts without file, by recalculating pace values for workouts created before v1.1.0.
By default, it only refreshes workouts with file.
Before executing the command, it is recommended to back up of all data (database and upload directory) in case a large number of workouts are refreshed.
Warning
If a weather data provider is defined and the --with-weather option is provided and/or an Elevation API URL is set and --with-elevation option is provided, the rate limit may be reached, resulting in API rate limit errors when a large number of workouts is refreshed.
Note
The missing elevations are updated only when –with-elevation is provided.
Options |
Description |
|---|---|
|
sport id |
|
sport id to which the workouts will be associated (must be provided with |
|
start date (format: |
|
end date (format: |
|
number of workouts per page (default: 10) |
|
page number (default: 1) |
|
workout date order: ‘asc’ or ‘desc’ (default: ‘asc’) |
|
username of workouts owner |
|
workout file extension (valid values are: tcx, kmz, gpx, kml, fit) |
|
enable weather data collection if weather provider is set and workout has no weather data. WARNING: depending on subscription, the rate limit can be reached, leading to errors and preventing weather data being collected during next uploads until the limit is reset (default: disabled) |
|
enable elevation update when elevation provider is set and some elevation data are missing. If disabled, existing elevation are not removed when elevation data are missing in the original file. WARNING: depending on subscription, the rate limit can be reached, leading to errors and preventing elevation data being collected during next uploads until the limit is reset (default: disabled) |
|
action to perform when workout file is not found. If not provided, an error will be raised. Valid actions are: |
|
allow to refresh workouts without a file and created before v1.1.0 to recalculate pace values (by default refresh command only refreshes workouts created with a file). When provided only workouts without file and without paces are refreshed (in this case ‘–extension’, ‘–with-weather’, ‘–with-elevation’ and ‘–on-file-error’ options are ignored). When not provided, only workouts with file are refreshed |
|
enable verbose output log (default: disabled) |