Compare commits

...

2 Commits

Author SHA1 Message Date
Kevin Bataille
d1e5fc1003 feat: Use preferred sesions as a template 2025-10-06 15:05:20 +02:00
Kevin Bataille
7d03f5b40c chore: Move docs and scripts into directories 2025-10-06 14:55:20 +02:00
10 changed files with 33 additions and 11 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.env
preferred_sessions.json
log/
!log/.gitkeep

View File

@@ -0,0 +1,22 @@
[
{
"day_of_week": 0,
"start_time": "17:45",
"session_name_contains": "WEIGHTLIFTING LOUVRE 3"
},
{
"day_of_week": 4,
"start_time": "17:00",
"session_name_contains": "CONDITIONING LOUVRE 3"
},
{
"day_of_week": 5,
"start_time": "12:30",
"session_name_contains": "HYROX"
},
{
"day_of_week": 5,
"start_time": "12:30",
"session_name_contains": "CONDITIONING"
}
]

View File

@@ -36,20 +36,19 @@ class SessionConfig:
preferred_sessions.append((day_of_week, start_time, session_name_contains))
except FileNotFoundError:
# Log a warning if the file is not found
logging.warning(f"Configuration file '{config_file}' not found. Falling back to default settings.")
# Log error and exit if the file is not found
logging.error(f"Configuration file '{config_file}' not found. Please create the configuration file.")
logging.error("You can copy 'preferred_sessions.json.example' to 'preferred_sessions.json' as a template.")
raise SystemExit(1)
except json.JSONDecodeError:
# Log a warning if the file is not a valid JSON
logging.warning(f"Failed to decode JSON from file '{config_file}'. Falling back to default settings.")
# Log error and exit if the file is not a valid JSON
logging.error(f"Failed to decode JSON from file '{config_file}'. Please check the file format.")
raise SystemExit(1)
# Fallback to default hardcoded sessions if no valid sessions were loaded
# Return empty list if no valid sessions were loaded
if not preferred_sessions:
preferred_sessions = [
(2, "18:30", "CONDITIONING"), # Wednesday 18:30 CONDITIONING
(4, "17:00", "WEIGHTLIFTING"), # Friday 17:00 WEIGHTLIFTING
(5, "12:30", "HYROX"), # Saturday 12:30 HYROX
]
return []
return preferred_sessions