WORKOUT_DATABASE = { "countFinishedTraining": 0, "imagePath": "defaultTraining.png", "isImagePathExternal": False, "name": "lol2", "orderNr": -1, "trainingPlanId": 0, "workoutSessions": [] } def create_workout_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_workout_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": "", "elapsedTime": 0, "finished": False, "imagePath": "jumping_jack.png", "isImagePathExternal": False, "isTimeMode": True, "isVideoMode": True, "isVideoPathExternal": True, "name": "Jumping Jack", "orderNr": -1, "prepTime": 5, "repetitionCount": 5, "videoPath": "", "workoutItemId": 0, "workoutSessionId": 1, "workoutTime": 30 } def get_item_id(): start = 0 while True: yield start start += 1 def create_item(name, workout_time, n_repetitions, description=None, preparation_time=5, video_path=None): is_video_mode = True if video_path else False new_item = dict(WOPRKOUT_ITEM) new_item_content = { "name": name, 'description': description or '', 'elapsedTime': 0, 'imagePath': '', 'isImagePathExternal': False, 'isTimeMode': True, 'isVideoMode': is_video_mode, 'prepTime': preparation_time, 'repetitionCount': n_repetitions, 'videoPath': video_path, "orderNr": next(get_item_id()), "workoutItemId": 0, "workoutSessionId": 1, 'workoutTime': workout_time } new_item.update(new_item_content) return new_item