Files

182 lines
5.4 KiB
Ruby
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env ruby -w
require 'date'
TestWatts = 295.0
Plan = [
# week 1
'45-60′ EM',
'60-90′ EM with 3x10′ SS (5′ RBI)',
'Rest Day',
'60-90′ EM with 3x10′ SS (5′ RBI)',
'Rest Day',
'90′ EM with 3x10′ SS (5′ RBI) or 90-120 group ride',
'90-120′ EM',
# week 2
'Rest Day',
'75-90′ EM with 3x12′ SS (6′ RBI)',
'Rest Day',
'75-90′ EM with 4x6′ OU (2U, 1O) (5′ RBI)',
'Rest Day',
'90-120′ EM with 4x6′ OU (2U, 1O) (5′ RBI)',
'90-120′ EM',
# week 3
'Rest Day',
'60-90′ EM with 2x[3x3′ SEPI (3′ RBI)] (8′ RBS)',
'Rest Day',
'60-90′ EM with 2x[3x3′ SEPI (3′ RBI)] (8′ RBS)',
'Rest Day',
'90-120′ EM with 3x9′ OU (2U, 1O) (6′ RBI)',
'90-150′ EM or group ride',
# week 4
'Rest Day',
'Rest Day or 45′ easy spinning',
'Rest Day',
'60-90′ EM with 2x[3x3′ SEPI (3′ RBI)] (8′ RBS)',
'Rest Day',
'90′ EM with 2x[3x3′ SEPI (2′ RBI)] (6′ RBS)',
'120-150′ EM or group ride',
# week 5
'Rest Day',
'60-90′ EM with 2x[3x3′ SEPI (2′ RBI)] (6′ RBS)',
'60-90′ EM with 2x[3x3′ SEPI (2′ RBI)] (6′ RBS)',
'Rest Day',
'Rest Day',
'90-120′ EM with 3x10′ OU (3U, 2O) (6′RBI)',
'90-150′ EM or group ride',
# week 6
'Rest Day',
'60-90′ EM with 6x3′ SEPI (3′ RBI)',
'60-90′ EM with 3x[3x2′ PFPI (1′ RBI)] (6′ RBS)',
'Rest Day',
'Rest Day',
'90-150′ EM with 3x12′ OU (2U, 2O) (8′RBI)',
'90-150′ EM or group ride',
# week 7
'Rest Day',
'60-90′ EM with 3x[3x2′ PFPI (2′ RBI)] (6′ RBS)',
'Rest Day',
'60-90′ EM with 3x[3x2′ PFPI (2′ RBI)] (6′ RBS)',
'Rest Day',
'90-120′ EM with 6x3′ SEPI (3′ RBI)',
'90-150′ EM or group ride',
# week 8
'Rest Day',
'60′ EM with 4x3′ FP (3′ RBI)',
'Rest Day',
'60-90′ EM with 4x2′ PFPI (1′ RBI); rest 8′; 4x3′ OU (2U, 1O) (3′ RBI)',
'Rest Day',
'90-150′ EM or group ride',
'90-150′ EM or group ride',
# week 9
'Rest Day',
'60-90′ EM with 6x2′ SEPI (2′ RBI)',
'Rest Day',
'60-90′ EM with 4x2′ PFPI (1′ RBI); rest 8′; 4x3′ OU (2U, 1O) (3′ RBI)',
'Rest Day',
'90-150′ EM with 3x12′ OU (2U, 2O) (8′ RBI)',
'90-150′ EM or group ride',
# week 10
'Rest Day',
'60-90′ EM with 6x2′ SEPI (2′ RBI)',
'Rest Day',
'60-90′ EM with 4x2′ PFPI (1′ RBI); rest 8′; 4x3′ OU (2U, 1O) (3′ RBI)',
'Rest Day',
'90-150′ EM with 3x12′ OU (2U, 2O) (8′ RBI)',
'90-150′ EM or group ride',
# week 11
'Rest Day',
'60-90′ EM with 6x2′ SEPI (2′ RBI)',
'Rest Day',
'60-90′ EM with 4x2′ PFPI (1′ RBI); rest 8′; 4x3′ OU (2U, 1O) (3′ RBI)',
'Rest Day',
'90-150′ EM with 3x12′ OU (2U, 2O) (8′ RBI)',
'90-150′ EM or group ride',
# recory week 1
'Rest Day',
'Rest Day',
'Rest Day',
'45-60′ easy spinning',
'Rest Day',
'Group ride or 90-120′ EM',
'90-120′ EM in hilly terrain',
# recory week 2
'Rest Day',
'60-90′ EM',
'Rest Day',
'75-90′ EM with 15′ at upper end of EM power or HR range',
'Rest Day',
'Group ride or 90-120′ EM with 15-20′ at upper end of EM power or HR range',
'90-120′ EM in hilly terrain',
# recory week 3
'Rest Day',
'60-90′ EM',
'Rest Day',
'75-90′ EM with 20′ at upper end of EM power or HR range',
'Rest Day',
'Group ride or 120-150′ EM with 30-40′ at upper end of EM power or HR range',
'90-120′ EM in hilly terrain',
# recory week 4
'Rest Day',
'60-90′ EM with 10-20′ at SS intensity',
'Rest Day',
'60-90′ EM with 6-8 PI-type efforts',
'Rest Day',
'Group ride or 120-150′ EM with 30-40′ at upper end of EM power or HR range',
'120-150′ EM in hilly terrain',
]
puts <<EOF
# BEGIN:VCALENDAR
# VERSION:2.0
# PRODID:-//Training Calendar//Stephen Waits//EN
# CALSCALE:GREGORIAN
# X-WR-CALNAME;VALUE=TEXT:Training
EOF
(Date.parse('2014-10-13')..Date.parse('2015-09-30')).each_with_index do |d, i|
plan_day = i % Plan.size
next if Plan[plan_day] == 'Rest Day'
week = (plan_day / 7) + 1
title = "W#{week}: #{Plan[plan_day]}"
desc = "Week #{week}, #{d.strftime('%A')}"
desc += " Workout: #{Plan[plan_day]}."
desc += " EM = EnduranceMiles, #{(0.45*TestWatts).to_i}-#{(0.73*TestWatts).to_i}W." if title =~ /\bEM\b/
desc += " TL = ThresholdLadders, PI+SS+CR." if title =~ /\bTL\b/
desc += " PI = PowerIntervals, #{(1.01*TestWatts).to_i}-Max W." if title =~ /\bPI\b/ || title =~ /\bTL\b/
desc += " PFPI = Peak-and-Fade PowerIntervals, #{(1.01*TestWatts).to_i}-Max W." if title =~ /\bPFPI\b/
desc += " SEPI = Steady Effort PowerIntervals, #{(1.01*TestWatts).to_i}-Max W." if title =~ /\bSEPI\b/
desc += " SS = SteadyState, #{(0.86*TestWatts).to_i}-#{(0.90*TestWatts).to_i}W." if title =~ /\bSS\b/ || title =~ /\bTL\b/
desc += " T = Tempo, #{(0.80*TestWatts).to_i}-#{(0.85*TestWatts).to_i}W." if title =~ /\bT\b/
desc += " CR = ClimbingRepeats, #{(0.95*TestWatts).to_i}-#{(1.00*TestWatts).to_i}W." if title =~ /\bCR\b/ || title =~ /\bTL\b/
desc += " OU = OverUnder (OU) Intervals, #{(0.86*TestWatts).to_i}-#{(0.90*TestWatts).to_i}W (Under), #{(0.95*TestWatts).to_i}-#{(1.00*TestWatts).to_i}W (Over)." if title =~ /\bOU\b/
desc += " FP = FastPedal, no target." if title =~ /\bFP\b/
dstr = d.strftime('%Y%m%d')
puts <<EOF
BEGIN:VEVENT
SUMMARY:#{title}
DESCRIPTION:#{desc}
DTSTAMP:#{dstr}T000000
DTSTART;VALUE=DATE:#{dstr}
DTEND;VALUE=DATE:#{dstr}
END:VEVENT
EOF
end
puts 'END:VCALENDAR'