#!/usr/bin/perl -w # # Use Festival to speak up and tell me to do exercises # # Last updated by rb on Sat Dec 6 21:14:24 EST 2003 # # # To make the exercise times more random, we run it every 1/2 # hour, but 1/3 of the time it exits silently with no output. exit 0 if rand > 0.6666667; # # Regular program starts here # use strict; use Festival::Client; use vars qw/$VERSION $DEBUG @usernames @exercises $line/; #$DEBUG = 1; $DEBUG = 0; $VERSION = "0.9"; @usernames = ( "Hey you", "Ms Buchanan", "Ricky Buchanan", "Ricky", "Master", "Boss", "Captain", "Soldier", "Kid", ); # To make the programming simpler, if I want to do an exercise # more often, I just put it in the array more times. Saves on # complicated hashes with percentage chances and stuff. @exercises = ( "take a deep breath and hold it for a moment.", "take a deep breath and hold it for a moment.", "take a deep breath and hold it for a moment.", "take a deep breath and hold it for a moment.", "take a deep breath and hold it for a moment.", "pull your toes back towards your nose.", "pull your toes back towards your nose.", "make circles with your ankles.", "make circles with your ankles.", "pelvic floor flicks.", "pelvic floor flicks.", "two squeezes and long holds with your pelvic floor.", "two squeezes and long holds with your pelvic floor.", "squeeze and hold your butt muscles in.", "squeeze and hold your butt muscles in.", "exhale and pull your tummy in and hold the exhalation.", "exhale and pull your tummy in and hold the exhalation.", "exhale and pull your tummy in and hold the exhalation.", "squeeze your shoulder blades together tightly.", "squeeze your shoulder blades together tightly.", "squeeze your shoulder blades together tightly.", "tighten your thigh muscles and straighten your knee.", "tighten your thigh muscles and straighten your knee.", "push your shoulders and back of head into the bed, arching your mid-back up.", "push your shoulders and back of head into the bed, arching your mid-back up.", "lift both arms together up overhead with your elbows straight.", "slide your foot back up towards your hip. First left then right.", ); # # Main # # Add a greeting 1/4 of the time $line .= $usernames[rand($#usernames)] . ", are you listening? " if rand > 0.75; $line .= "Exercises now. The next one is "; $line .= $exercises[rand($#exercises)]; # pick a random exercise if ($DEBUG) { warn "Line generated: '$line'\n"; } else { # Say it my $Festival = Festival::Client->new("localhost") or die "Can't connect to Festival server."; $Festival->say($line); } exit 0; # # End. #