feat: preferred sessions are now external
This commit is contained in:
48
README.md
48
README.md
@@ -30,6 +30,20 @@ docker-compose up --build
|
||||
|
||||
The application will automatically check for available sessions and book them based on your preferences. It will send notifications via email and Telegram when a booking is successful.
|
||||
|
||||
### Configuring Preferred Sessions
|
||||
|
||||
You can configure your preferred sessions using the `preferred_sessions.json` file. This file should contain a JSON array of session names, for example:
|
||||
|
||||
```json
|
||||
[
|
||||
"Morning Class",
|
||||
"Evening Class",
|
||||
"Saturday Open Gym"
|
||||
]
|
||||
```
|
||||
|
||||
If the file is not found or contains invalid data, the application will use default hardcoded sessions.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
The following environment variables are required:
|
||||
@@ -44,16 +58,36 @@ The following environment variables are required:
|
||||
|
||||
### Preferred Sessions
|
||||
|
||||
You can configure your preferred sessions in the `crossfit_booker.py` file. The preferred sessions are defined as a list of tuples, where each tuple contains the day of the week, start time, and session name.
|
||||
You can configure your preferred sessions in the `preferred_sessions.json` file. The preferred sessions are defined as a list of objects, where each object contains the day of the week, start time, and session name.
|
||||
|
||||
```python
|
||||
PREFERRED_SESSIONS = [
|
||||
(4, "17:00", "WEIGHTLIFTING"), # Friday 17:00 WEIGHTLIFTING
|
||||
(5, "12:30", "HYROX"), # Saturday 12:30 HYROX
|
||||
(2, "18:30", "CONDITIONING"), # Wednesday 18:30 CONDITIONING
|
||||
```json
|
||||
[
|
||||
{
|
||||
"day_of_week": 4,
|
||||
"start_time": "17:00",
|
||||
"session_name_contains": "WEIGHTLIFTING"
|
||||
},
|
||||
{
|
||||
"day_of_week": 5,
|
||||
"start_time": "12:30",
|
||||
"session_name_contains": "HYROX"
|
||||
},
|
||||
{
|
||||
"day_of_week": 2,
|
||||
"start_time": "18:30",
|
||||
"session_name_contains": "CONDITIONING"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
The application will automatically load the preferred sessions from this file. If the file is not found or contains invalid data, it will fall back to the default hardcoded sessions.
|
||||
|
||||
#### Fields
|
||||
|
||||
- `day_of_week`: Integer representing the day of the week (0=Monday, 6=Sunday)
|
||||
- `start_time`: String representing the start time in HH:MM format
|
||||
- `session_name_contains`: String containing the name or part of the name of the session
|
||||
|
||||
## Files
|
||||
|
||||
- `Dockerfile`: Docker image definition
|
||||
@@ -64,6 +98,7 @@ PREFERRED_SESSIONS = [
|
||||
- `book_crossfit.py`: Main application script
|
||||
- `crossfit_booker.py`: Crossfit booking script
|
||||
- `session_notifier.py`: Session notification script
|
||||
- `preferred_sessions.json`: Configuration file for preferred sessions
|
||||
- `requirements.txt`: Python dependencies
|
||||
|
||||
## Project Structure
|
||||
@@ -79,6 +114,7 @@ PREFERRED_SESSIONS = [
|
||||
├── crossfit_booker.py
|
||||
├── session_notifier.py
|
||||
├── requirements.txt
|
||||
├── preferred_sessions.json
|
||||
└── log
|
||||
└── crossfit_booking.log
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user