Skip to content

Commit 601d068

Browse files
Add 'start' and 'next' commands
1 parent b5089a5 commit 601d068

File tree

1 file changed

+82
-6
lines changed

1 file changed

+82
-6
lines changed

main.py

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
# (C) 2021 - 2022
33

44
# Workout Options
5-
# Start workout - get time, list first item
65
# Item complete - show time completed, start new time, show percentage, move to next workout
76
# Workout finished - show total time, activities completed
87
# Stats - time, percentage complete
98
# Video - play video for that group
109

1110
# Import Statements
1211
import subprocess
13-
from datetime import datetime
14-
import time
12+
from datetime import datetime, date
13+
import time
1514

1615
# Workout Lists
1716
groups = ["Abs", "Quads", "Glutes", "Triceps", "Biceps", "Back", "Chest"]
18-
sunday = ["Situps\t", "Reverse Crunches", "Bicycle Crunches", "Flutter Kicks", "Leg Raises\t", "Elbow Planks\t"]
17+
abs = ["Situps\t", "Reverse Crunches", "Bicycle Crunches", "Flutter Kicks", "Leg Raises\t", "Elbow Planks\t"]
1918
sunday_count = [25, 25, 25, 25, 25, 2]
2019
monday = ["Lunges\t", "High Knees\t", "Side Kicks\t", "Mountain Climbers", "Plank Jump Ins", "Lunges & Step Ups"]
2120
monday_count = [50, 50, 50, 25, 25, 50]
@@ -35,6 +34,12 @@
3534
def openvideo():
3635
sunday = subprocess.Popen(["C:\Program Files\VideoLAN\VLC\vlc.exe", "file:\\\D:\Videos\Workout Videos\10 Minute Ab Workout.mp4"])
3736

37+
# Percentage
38+
def percent(group, no):
39+
num = int((no/len(group))*100)
40+
num = str(num) + "%"
41+
return num
42+
3843
# Welcome
3944
print(" WELCOME TO PyWORKOUT")
4045
print("Please select a group from those below.")
@@ -45,6 +50,7 @@ def openvideo():
4550
# Display Workout Options
4651
run_options = True
4752
while run_options == True:
53+
global select
4854
select = str(input("\nGroup? "))
4955
if select.lower() == "1" or select.lower() == "abs":
5056
print("Ab muscle group selected!\n")
@@ -88,11 +94,79 @@ def openvideo():
8894
if activity.lower() == "list":
8995
if select == "abs":
9096
for i in range(len(sunday)):
91-
print(str(i+1) + ". " + str(sunday[i]) + "\t 2 Reps of " + str(sunday_count[i]))
97+
print(str(i+1) + ". " + str(sunday[i]) + "\t 2 Sets of " + str(sunday_count[i]) + " Reps")
98+
print("")
99+
elif select == "quads":
100+
for i in range(len(monday)):
101+
print(str(i+1) + ". " + str(monday[i]) + "\t 2 Sets of " + str(monday_count[i]) + " Reps")
102+
print("")
103+
elif select == "glutes":
104+
for i in range(len(tuesday)):
105+
print(str(i+1) + ". " + str(tuesday[i]) + "\t 2 Sets of " + str(tuesday_count[i]) + " Reps")
106+
print("")
107+
elif select == "triceps":
108+
for i in range(len(wednesday)):
109+
print(str(i+1) + ". " + str(wednesday[i]) + "\t 2 Sets of " + str(wednesday_count[i]) + " Reps")
110+
print("")
111+
elif select == "biceps":
112+
for i in range(len(thursday)):
113+
print(str(i+1) + ". " + str(thursday[i]) + "\t 2 Sets of " + str(thursday_count[i]) + " Reps")
114+
print("")
115+
elif select == "back":
116+
for i in range(len(friday)):
117+
print(str(i+1) + ". " + str(friday[i]) + "\t 2 Sets of " + str(friday_count[i]) + " Reps")
118+
print("")
119+
elif select == "chest":
120+
for i in range(len(saturday)):
121+
print(str(i+1) + ". " + str(saturday[i]) + "\t 2 Sets of " + str(saturday_count[i]) + " Reps")
122+
print("")
123+
run_activity = True
124+
elif activity.lower() == "start":
125+
global activity_num
126+
global start_time
127+
start_time = date.today()
128+
activity_num = 0
129+
print("You have started the " + select + " muscle group. ")
130+
print("The current time is: " + str(time.strftime("%H:%M:%S")) + " - " + str(date.today()-start_time) + " has elapsed.")
131+
print("You have completed: " + percent(select, 0))
132+
if select == "abs":
133+
print("Please complete 2 Sets of " + str(sunday_count[activity_num]) + " Reps of " + str(abs[activity_num]))
134+
elif select == "quads":
135+
for i in range(len(monday)):
136+
print(str(i+1) + ". " + str(monday[i]) + "\t 2 Sets of " + str(monday_count[i]))
137+
print("")
138+
elif select == "glutes":
139+
for i in range(len(tuesday)):
140+
print(str(i+1) + ". " + str(tuesday[i]) + "\t 2 Reps of " + str(tuesday_count[i]))
141+
print("")
142+
elif select == "triceps":
143+
for i in range(len(wednesday)):
144+
print(str(i+1) + ". " + str(wednesday[i]) + "\t 2 Reps of " + str(wednesday_count[i]))
92145
print("")
146+
elif select == "biceps":
147+
for i in range(len(thursday)):
148+
print(str(i+1) + ". " + str(thursday[i]) + "\t 2 Reps of " + str(thursday_count[i]))
149+
print("")
150+
elif select == "back":
151+
for i in range(len(friday)):
152+
print(str(i+1) + ". " + str(friday[i]) + "\t 2 Reps of " + str(friday_count[i]))
153+
print("")
154+
elif select == "chest":
155+
for i in range(len(saturday)):
156+
print(str(i+1) + ". " + str(saturday[i]) + "\t 2 Reps of " + str(saturday_count[i]))
157+
print("")
158+
print("")
159+
activity_num = activity_num + 1
160+
run_activity = True
161+
elif activity.lower() == "next":
162+
print("You are in the " + select + " muscle group. ")
163+
print("The current time is: " + str(time.strftime("%H:%M:%S")) + " - " + str(date.today()-start_time) + " has elapsed.")
164+
print("You have completed: " + percent(select, activity_num))
165+
if select == "abs":
166+
print("Please complete 2 Sets of " + str(sunday_count[activity_num]) + " Reps of " + str(sunday[activity_num]))
93167
elif select == "quads":
94168
for i in range(len(monday)):
95-
print(str(i+1) + ". " + str(monday[i]) + "\t 2 Reps of " + str(monday_count[i]))
169+
print(str(i+1) + ". " + str(monday[i]) + "\t 2 Sets of " + str(monday_count[i]))
96170
print("")
97171
elif select == "glutes":
98172
for i in range(len(tuesday)):
@@ -114,6 +188,8 @@ def openvideo():
114188
for i in range(len(saturday)):
115189
print(str(i+1) + ". " + str(saturday[i]) + "\t 2 Reps of " + str(saturday_count[i]))
116190
print("")
191+
print("")
192+
activity_num = activity_num + 1
117193
run_activity = True
118194
elif activity.lower() == "quit":
119195
run_activity = False

0 commit comments

Comments
 (0)