Reading ZWO files


(Cam Fraser Nuun-Sigma Sports-London) #1

Hi Zwifters,

Does anyone know of a program or method to read ZWO files in “normal” language if a workout were to be described on a website or blog for example:

Show title and workout description followed by the workout:

Warm up from 50% to 75% FTP, 5 minutes at 80% FTP following by 10 minutes warm down from 75% to 50% FTP. 

I have several workouts designed in Zwift that I would like to show in “laypersons” terms but wanted to find out if there was a smart way to extract the work out back to something readable rather than typing each workout out which will take a bit of time.

I have found a number of tools that create a ZWO file from this info but I am looking to do it the other way.

Thanks in advance.


(Mike Hanney [KRT] #W4R) #2

Here’s a python script that does what you need

https://github.com/mhanney/zwoparse

It needs the athlete’s FTP and weight in Kg as inputs to also output the absolute power and W/Kg targets. (You could easily remove that part).

Just curious - what’s it for?

Mike

 

 

 

 

 

 

 

 

 


(Cam Fraser Nuun-Sigma Sports-London) #3

Hi Mike.

Thanks for the reply. Its to easily convert the content and structure of ZWO files in order to use the text/copy on a website, to share with others etc.  Essentially explaining the workout structure in a way that people who aren’t experts in training and/or zwift can understand.  

As i have a number of zwo files this would save a whole heap of time rather than writing them all out.

I am not a programming or computer expert so would you mind explaining how I can go about using the coding you have provided to decipher the zwo files? Do I need a special program?

Thanks

Cam


(Mike Hanney [KRT] #W4R) #4

Hi Cam,

You need to install the Python interpreter on your computer (and download the zwoparser.py script I linked to above). If you use a Mac then python is already installed (10.3 Panther and later). For Windows, you can download it here. https://www.python.org/downloads/ Choose the 2.7 version. 

After downloading the zwoparser.py script, you run it by opening a terminal window (mac) or command prompt (windows), and typing python, followed by the script name, the file name you want to convert and some additional parameters for ftp, weight, the format you want, and where to save the output tile. For example:

python zwoparser.py JonsMix.zwo -f 266 -k 71 -t txt -o JonsMix.txt

Where the number after -f is FTP, and the number after -k is weight in kilos. -t txt means make a text file, and -o means output filename JonsMix.txt

The path to the python interpreter, the zwoparser.py script, and the .zwo file might need to be written in full, like this:

C:\Python27\python.exe “C:\Users\<username>\Documents\zwoparser.py” “C:\Users\<username>\Documents\Zwift\Workouts\Jon_s_Mix.zwo” -f 266 -k 71 -t txt -o JonsMix.txt

replace <username> with your user name on windows.

Good luck. If none of that made any sense, I’ll see if I can put a drag ‘n’ drop web form in front of it some time, but to be honest, a script like that takes about 20 minutes to write and a user interface takes about 20 hours, so I can’t promise anything.

Mike.

 

 

 

 


(Cam Fraser Nuun-Sigma Sports-London) #5

Hi Mike,

Thank you so much. That worked and I had to use the full file path text.

The only thing I see is missed is guide text such as

"<Warmup Duration=“600” PowerLow=“0.50449997” PowerHigh=“0.75449997” pace=“0”>
<textevent timeoffset=“30” message=“Include 3 x 6 sec high cadence / low power sprints during warm up.”/>
</Warmup>

which in this case would give the user in Zwift the text "Include 3 x 6 sec high cadence / low power sprints during warm up.

I guess this is all in the programming?

Cam


(Mike Hanney [KRT] #W4R) #6

Hi Cam,

Great to hear you got python working. Nice work! 

I’ve updated the script to include those text messages. (I didn’t need them for what I was doing with this originally). I also noticed there is a rest cadence as well as normal cadence in intervals, so I added that too.

Best,
Mike

 

 

 


(Cam Fraser Nuun-Sigma Sports-London) #7

Mike, incredibly helpful so thanks. This will save me loads of time and help people to understand the basis of the workout.

Merry Christmas,

Cam


(Piotr Stangret) #8

Good day Mike, 

I have been searching for a while for a way to import .ZWO files into TP and your script seems to be the only available option. I have followed your instructions. Script works and converts .ZWO files but I keep getting error from TP when importing saying:

“A file with multiple workouts cannot be uploaded to a single workout.
Instead, upload using AutoSync, drag and drop, or the Upload button above the calendar.”

When I try the “Upload” I am getting “Could not parse the file”.

The same happens both with .txt and .csv files.

Your help would be much appreciated.

Best

Piotr

PS: I am including the top few lines of the .txt file below:

Type, StartTime, EndTime, Duration, Duration Formatted, Min Power (% FTP), Min Power (W), Min Power (W/Kg), Max Power (% FTP), Min Power (W), Min Power (W/Kg), Cadence, Work
Steady state,0,120,120,2 mins,60,133,1.9,60,133,1.9,False
Steady state,120,240,120,2 mins,68,151,2.1,68,151,2.1,False


(Mike Hanney [KRT] #W4R) #9

Hello Piotr,

I have not been able to find any information regarding what file formats TP accepts for importing structured workouts.

I made up the .txt and .csv formats so I would not expect those to work.

Do you have an example TP structured workout file that does import? I could probably copy its format. Unfortunately I have no way to test as I no longer use TP.

Mike