From 634eb6f9585d7fd98215a6a5ba1cc951f6dab3fc Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Sun, 4 Oct 2020 13:54:40 +0300 Subject: [PATCH] Rename to zwiftout + add docs --- README.md | 113 ++++++++++++++++++++++++++- bin/{make-workout.js => zwiftout.js} | 0 package.json | 10 ++- 3 files changed, 118 insertions(+), 5 deletions(-) rename bin/{make-workout.js => zwiftout.js} (100%) diff --git a/README.md b/README.md index 8b000f1..f97afdd 100644 --- a/README.md +++ b/README.md @@ -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 `` 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/ diff --git a/bin/make-workout.js b/bin/zwiftout.js similarity index 100% rename from bin/make-workout.js rename to bin/zwiftout.js diff --git a/package.json b/package.json index 47b7ccd..850e6e3 100644 --- a/package.json +++ b/package.json @@ -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 ", "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",