Rename to zwiftout + add docs

This commit is contained in:
Rene Saarsoo 2020-10-04 13:54:40 +03:00
parent 0d6f61913c
commit 634eb6f958
3 changed files with 118 additions and 5 deletions

113
README.md
View File

@ -1,4 +1,111 @@
# Zwift workout generator
# Zwiftout
[Zwift][] workout generator command line tool and library.
## Motivation
Creating custom workouts is a pain.
The workout editor in Zwift is pretty clumsy and slow to use:
- drag'n'drop is not the fastest way to edit,
- positioning of messages is especially tricky as they easily jump out of place,
- there's no copy-paste functionality to speed things up.
Editing .zwo files by hand is also inconvenient:
- you'll have to constantly convert minutes to seconds,
- you can easily make errors in XML syntax, rendering the file invalid,
- The syntax is quite inconsistent, making it hard to memoize.
There are a few alternative editors online:
- [ZWOFactory][] is very much point'n'click based which doesn't help much with speeding up the process.
- [Simple ZWO Creator][] is more akin to my liking as it's text-based.
But it's lacking lots of features: no way to add cadence, text messages, warmup/cooldown etc.
The syntax used is also kinda confusing.
## Features
- Fully text-based workout creation.
- Easily add cadence targets.
- Easily place text-messages within intervals.
- Support for Warmup/Cooldown & FreeRide interval types.
- Automatic detection of repeated intervals - conversion to `<IntervalsT>` in .zwo file.
- Generation of stats: average and normalized intensity, TSS, zone-distribution.
## Install
```
$ npm install -g zwiftout
```
## Usage
Write a workout description like:
```
Name: Sample workout
Author: John Doe
Description: Try changing it, and see what happens below.
Warmup: 10:00 30%..75%
Interval: 15:00 100% 90rpm
@ 00:00 Start off easy
@ 01:00 Settle into rhythm
@ 07:30 Half way through
@ 14:00 Final minute, stay strong!
Rest: 10:00 75%
FreeRide: 20:00
@ 00:10 Just have some fun, riding as you wish
Cooldown: 10:00 70%..30%
```
Feed that file into `zwiftout` program, which spits out Zwift workout XML:
```
$ zwiftout my-workout.txt > my-workout.zwo
```
Also, you can query various stats about the workout:
```
$ zwiftout --stats my-workout.txt
Total duration: 65 minutes
Average intensity: 50%
Normalized intensity: 75%
TSS: 60
Zone Distribution:
14 min - Z1: Recovery
6 min - Z2: Endurance
10 min - Z3: Tempo
15 min - Z4: Threshold
0 min - Z5: VO2 Max
0 min - Z6: Anaerobic
20 min - Freeride
```
## Usage as library
```js
import { parse, generateZwo, stats } from "zwiftout";
const workout = parse(`
Name: Sample workout
Warmup: 10:00 30%..75%
Interval: 15:00 100% 90rpm
`);
// Output ZWO file
console.log(generateZwo(workout));
// Output various statistics
console.log(stats(workout));
```
## TODO
@ -6,3 +113,7 @@
- Unsupported params: message duration & y-position
- More restricted syntax for text (with quotes)
- Support for tags
[zwift]: https://zwift.com/
[zwofactory]: https://zwofactory.com/
[simple zwo creator]: https://zwifthacks.com/app/simple-zwo-creator/

View File

@ -1,13 +1,15 @@
{
"name": "make-workout",
"version": "0.0.0",
"name": "zwiftout",
"version": "0.1.0",
"license": "GPL-3.0-or-later",
"description": "Zwift workout generator command line tool and library",
"author": "Rene Saarsoo <github@triin.net>",
"scripts": {
"lint:ts": "tsc --noEmit",
"lint:js": "eslint 'src/**/*'",
"test": "jest src/ test/",
"test:watch": "jest src/ test/ --watch",
"start": "node bin/make-workout.js",
"start": "node bin/zwiftout.js",
"format:js": "prettier --write src/",
"build": "tsc --project tsconfig.release.json",
"prepublish": "yarn build"
@ -15,7 +17,7 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"make-workout": "./bin/make-workout.js"
"zwiftout": "./bin/zwiftout.js"
},
"dependencies": {
"argparse": "^2.0.1",