diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..7a5c695 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,31 @@ +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "tabulate" +version = "0.9.0" +description = "Pretty-print tabular data" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f"}, + {file = "tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"}, +] + +[package.extras] +widechars = ["wcwidth"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "b150127ccf08d946a8929e59eacb6673ab2e140ede4a7aef26cc4e1b5820b092" diff --git a/pump.py b/pump.py index e30d6f6..d226488 100755 --- a/pump.py +++ b/pump.py @@ -10,116 +10,30 @@ from gain import display_exercise_table #from reps import show_relative_intensity_table -exercises = [ - [ - "Chest", [ - - ("b", "bb_bench", "Bench press"), - ("db", "db_bench", "Db bench press"), - ("i", "bb_incline_bench", "Incline bench"), - ("ib", "db_incline_bench", "Db incline bench"), - ("cf", "cable_fly", "Cable fly"), - ("lcf", "cable_low_fly", "Low cable fly"), - #("pb", "pause_bench", "Pause bench"), - #("drp", "drop_bench", "Drop bench"), - ("wp", "weighted_pushup", "Weighted pushup"), - ("1p", "1arm_pushup", "One-arm pushup"), - ("pu", "pushup", "Push up"), - ]], - - [ - "Back", [ - - ("d", "deadlift", "Deadlift"), - ("pp", "pullup", "Pullup"), - ("r", "bb_row", "Row"), - ("dr", "db_row", "Db row"), - ("po", "db_pullover", "Db pullover"), - ("cp", "cable_pulldown", "Cable pulldown"), - ]], - - [ - "Shoulders", [ - - ("sp", "bb_press", "Shoulder press"), - ("dp", "db_press", "Db shoulder press"), - ("mp", "bb_military_press", "Military press"), - ("kp", "kb_overhead_press", "Kb overhead press"), - #("ap", "arnold_press", "Arnold press"), - ("hp", "handstand_press", "Handstand press"), - ("fr", "front_raise", "Front raise"), - ("lr", "lat_raise", "Lat raise"), - ("kbh", "kb_halo", "Kb halo"), - ("kbg", "kb_getup", "Kb getup"), - ]], - - [ - "Legs", [ - - ("s", "squat", "Squat"), - ("l", "lunge", "Lunge"), - ("ss", "split_squat", "Split squat"), - ("bx", "box_squat", "Box squat"), - ("sms", "smith_machine_squat", "Smith machine squat"), - ("hs", "hack_squat", "Hack squat"), - ("ht", "hip_thrust", "Hip thrust"), - ("rdl", "romanian_deadlift", "Romanian deadlift"), - ("asl", "alt_leg_deadlift", "Alt leg deadlift"), - ("kdl", "kb_deadlift", "Kb deadlift"), - ("ks", "kb_swing", "Kb swing"), - ("sol", "soleo", "Soleo"), - ("lp", "leg_press", "Leg press"), - ("gm", "good_morning", "Good morning"), - ("sgm", "seated_good_morning", "Seated good morning"), - ]], - - [ - "Biceps", [ - - ("bc", "bb_curl", "Curl"), - ("cc", "cable_curl", "Cable curl"), - ("dc", "db_curl", "Db curl"), - ("hc", "hammer_curl", "Hammer curl"), - ("pc", "preacher_curl", "Preacher curl"), - ("ic", "incline_curl", "Incline curl"), - ]], - - [ - "Triceps", [ - - ("sk", "skullcrusher", "Skullcrusher"), - ("p", "cable_pushdown", "Cable pushdown"), - ("k", "tricep_kickback", "Tricep kickback"), - ("dip", "dips", "Dips"), - ("dm", "diamond_pushup", "Diamond pushup"), - ("o", "cable_overhead_ext", "Cable overhead ext"), - ]], - - [ - "Core", [ - - ("hr", "hanging_raise", "Hanging raise"), - ("ws", "weighted_situp", "Weighted situp"), - ]], - # ("c", "", "Custom"), -] - -def get_all_exercises(): +def normie_name(name): + return name.replace(" ", "_")\ + .replace("-", "_")\ + .toLowerCase()\ + .title() + +def load_exercises(filename): + with open(filename) as fd: + return json.load(fd) + +def get_all_exercises(exercises): all_exercises = [] - for body_part, exer in exercises: - all_exercises.extend(exer) + for _, exs in exercises.items(): + all_exercises.extend(exs) return all_exercises -def build_maps(): +def build_maps(exercises): keymap = {} descs = {} - for key, exercise_tag, exercise_desc in get_all_exercises(): + for key, exercise_tag, exercise_desc in get_all_exercises(exercises): keymap[key] = exercise_tag descs[exercise_tag] = exercise_desc return keymap, descs -keymap, descs = build_maps() - CONTINUE = 0 EXIT = 1 @@ -204,13 +118,14 @@ def save_session(session): session_start = time.time() start = time.time() -def entry(): +def entry(exercises): global session_start, start + keymap, descs = build_maps(exercises) table = [] current_row = [] idx = 0 - for body_part, exers in exercises: + for body_part, exers in exercises.items(): if idx > 0: table.append([]) for key, _, name in exers: @@ -299,8 +214,9 @@ def main(argv): if len(argv) > 1: dirname = argv[1] + exercises = load_exercises("wkt.json") while True: - if entry() == EXIT: + if entry(exercises) == EXIT: return 0 if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..756538d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "pump" +version = "0.1.0" +description = "" +authors = ["Your Name "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +tabulate = "^0.9.0" +colorama = "^0.4.6" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/wkt.json b/wkt.json new file mode 100644 index 0000000..13b1589 --- /dev/null +++ b/wkt.json @@ -0,0 +1,69 @@ +{ + "Chest": [ + ["b", "bb_bench", "Bench press"], + ["db", "db_bench", "Db bench press"], + ["i", "bb_incline_bench", "Incline bench"], + ["ib", "db_incline_bench", "Db incline bench"], + ["cf", "cable_fly", "Cable fly"], + ["lcf", "cable_low_fly", "Low cable fly"], + ["wp", "weighted_pushup", "Weighted pushup"], + ["1p", "1arm_pushup", "One-arm pushup"], + ["pu", "pushup", "Push up"] + ], + "Back": [ + ["d", "deadlift", "Deadlift"], + ["pp", "pullup", "Pullup"], + ["r", "bb_row", "Row"], + ["dr", "db_row", "Db row"], + ["po", "db_pullover", "Db pullover"], + ["cp", "cable_pulldown", "Cable pulldown"] + ], + "Shoulders": [ + ["sp", "bb_press", "Shoulder press"], + ["dp", "db_press", "Db shoulder press"], + ["mp", "bb_military_press", "Military press"], + ["kp", "kb_overhead_press", "Kb overhead press"], + ["hp", "handstand_press", "Handstand press"], + ["fr", "front_raise", "Front raise"], + ["lr", "lat_raise", "Lat raise"], + ["kbh", "kb_halo", "Kb halo"], + ["kbg", "kb_getup", "Kb getup"] + ], + "Legs": [ + ["s", "squat", "Squat"], + ["l", "lunge", "Lunge"], + ["ss", "split_squat", "Split squat"], + ["bx", "box_squat", "Box squat"], + ["sms", "smith_machine_squat", "Smith machine squat"], + ["hs", "hack_squat", "Hack squat"], + ["ht", "hip_thrust", "Hip thrust"], + ["rdl", "romanian_deadlift", "Romanian deadlift"], + ["asl", "alt_leg_deadlift", "Alt leg deadlift"], + ["kdl", "kb_deadlift", "Kb deadlift"], + ["ks", "kb_swing", "Kb swing"], + ["sol", "soleo", "Soleo"], + ["lp", "leg_press", "Leg press"], + ["gm", "good_morning", "Good morning"], + ["sgm", "seated_good_morning", "Seated good morning"] + ], + "Biceps": [ + ["bc", "bb_curl", "Curl"], + ["cc", "cable_curl", "Cable curl"], + ["dc", "db_curl", "Db curl"], + ["hc", "hammer_curl", "Hammer curl"], + ["pc", "preacher_curl", "Preacher curl"], + ["ic", "incline_curl", "Incline curl"] + ], + "Triceps": [ + ["sk", "skullcrusher", "Skullcrusher"], + ["p", "cable_pushdown", "Cable pushdown"], + ["k", "tricep_kickback", "Tricep kickback"], + ["dip", "dips", "Dips"], + ["dm", "diamond_pushup", "Diamond pushup"], + ["o", "cable_overhead_ext", "Cable overhead ext"] + ], + "Core": [ + ["hr", "hanging_raise", "Hanging raise"], + ["ws", "weighted_situp", "Weighted situp"] + ] +}