You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

91 lines
2.4 KiB

import json
WORKOUT_DATABASE = {
"countFinishedTraining": 0,
"imagePath": "defaultTraining.png",
"isImagePathExternal": False,
"name": "lol2",
"orderNr": -1,
"trainingPlanId": 0,
"workoutSessions": []
}
def create_work_database(name, workout_sessions):
new_db = dict(WORKOUT_DATABASE)
new_content = {
"name": name,
"workoutSessions": workout_sessions
}
new_db.update(new_content)
return new_db
WORKOUT_SESSION = {
"finished": False,
"name": "1. day",
"orderNr": -1,
"trainingPlanId": 13,
"workoutItems": [],
"workoutSessionId": 0
}
def create_work_session(workout_items: list):
new_session = dict(WORKOUT_SESSION)
new_session_content = {
"workoutItems": workout_items
}
new_session.update(new_session_content)
return new_session
WOPRKOUT_ITEM = {
"breakTime": 2,
"description": "Stand up with your legs spread and your hands touching overhead. Then as you jump, bring your legs back together and put your arms to your sides. You can speed these up or slow them down to suit your fitness level.",
"elapsedTime": 0,
"finished": False,
"imagePath": "jumping_jack.png",
"isImagePathExternal": False,
"isTimeMode": True,
"isVideoMode": True,
"isVideoPathExternal": False,
"name": "Jumping Jack",
"orderNr": -1,
"prepTime": 5,
"repetitionCount": 5,
"videoPath": "jumping_jack.mp4",
"workoutItemId": 0,
"workoutSessionId": 1,
"workoutTime": 30
}
def create_item():
new_item = dict(WOPRKOUT_ITEM)
new_item_content = {
"description": "Stand up with your legs spread and your hands touching overhead. Then as you jump, bring your legs back together and put your arms to your sides. You can speed these up or slow them down to suit your fitness level.",
"elapsedTime": 0,
"imagePath": "jumping_jack.png",
"isImagePathExternal": False,
"isTimeMode": True,
"isVideoMode": True,
"prepTime": 5,
"repetitionCount": 5,
"videoPath": "jumping_jack.mp4",
"workoutTime": 30
}
new_item.update(new_item_content)
return new_item
def lasdikfsh():
items = [create_item()]
sessions = [create_work_session(items)]
db = create_work_database('urdur', sessions)
with open("your_json_file.json", "w") as fp:
json.dump(db , fp)
if __name__ == '__main__':
lasdikfsh()