A lot of features #1

Merged
kbe merged 11 commits from develop into main 2025-07-20 14:32:07 +00:00
Showing only changes of commit 870a65301d - Show all commits

View File

@@ -29,7 +29,8 @@ if not all([USERNAME, PASSWORD]):
APPLICATION_ID = "81560887"
CATEGORY_ID = "677" # Activity category ID for CrossFit
TIMEZONE = "Europe/Paris" # Adjust to your timezone
TARGET_RESERVATION_TIME = "20:01" # When bookings open (8 PM)
# TARGET_RESERVATION_TIME = "20:01" # When bookings open (8 PM)
TARGET_RESERVATION_TIME = "21:40" # When bookings open (8 PM)
DEVICE_TYPE = "3"
# Retry configuration
@@ -365,7 +366,7 @@ class CrossFitBooker:
activities = sessions_data.get("data", {}).get("activities_calendar", [])
# Find sessions to book (both preferred and any available)
# Find sessions to book (prefered only)
sessions_to_book = []
for session in activities:
if not self.is_session_bookable(session, current_time):
@@ -373,9 +374,6 @@ class CrossFitBooker:
if self.matches_preferred_session(session, current_time):
sessions_to_book.append(("Preferred", session))
elif current_time.strftime("%H:%M") == TARGET_RESERVATION_TIME:
# At booking time, consider all available sessions
sessions_to_book.append(("Available", session))
if not sessions_to_book:
logging.info("No matching sessions found to book")
@@ -384,7 +382,7 @@ class CrossFitBooker:
# Book sessions (preferred first)
sessions_to_book.sort(key=lambda x: 0 if x[0] == "Preferred" else 1)
for session_type, session in sessions_to_book:
session_time = datetime.strptime(session["start_datetime"], "%Y-%m-%d %H:%M:%S")
session_time = datetime.strptime(session["start_timestamp"], "%Y-%m-%d %H:%M:%S")
logging.info(f"Attempting to book {session_type} session at {session_time} ({session['name_activity']})")
if self.book_session(session["id_activity_calendar"]):
logging.info(f"Successfully booked {session_type} session at {session_time}")