From 75f2d7a063443c388a3e739500544f66320cc490 Mon Sep 17 00:00:00 2001 From: Rob Holland Date: Thu, 13 Feb 2025 17:14:59 +0000 Subject: [PATCH 1/2] Reduce the number of train options returned. --- thirdparty/train_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thirdparty/train_api.py b/thirdparty/train_api.py index d5dd584..a48b1c8 100644 --- a/thirdparty/train_api.py +++ b/thirdparty/train_api.py @@ -82,7 +82,7 @@ class TrainServer(BaseHTTPRequestHandler): # Generate outbound journeys year, month, day, hour, minute = out_datetime - for offset in [-60, -30, 0, 30, 60]: + for offset in [-30, 0, 30]: # Calculate journey times adj_minutes = minute + offset adj_hour = hour + (adj_minutes // 60) @@ -118,7 +118,7 @@ class TrainServer(BaseHTTPRequestHandler): # Generate return journeys if return datetime provided if ret_datetime[0] is not None: year, month, day, hour, minute = ret_datetime - for offset in [-60, -30, 0, 30, 60]: + for offset in [-30, 0, 30]: adj_minutes = minute + offset adj_hour = hour + (adj_minutes // 60) adj_minute = adj_minutes % 60 From 94cbce78ebbdf06c2376e7e259950bfcbe31a6ef Mon Sep 17 00:00:00 2001 From: Rob Holland Date: Thu, 13 Feb 2025 17:17:13 +0000 Subject: [PATCH 2/2] Remove platform from JSON. --- thirdparty/train_api.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/thirdparty/train_api.py b/thirdparty/train_api.py index a48b1c8..1c40e45 100644 --- a/thirdparty/train_api.py +++ b/thirdparty/train_api.py @@ -110,7 +110,6 @@ class TrainServer(BaseHTTPRequestHandler): "arrival_time": format_datetime( year, month, arr_day, arr_hour, arr_minute ), - "platform": str(random.randint(1, 8)), "price": round(30 + random.random() * 50, 2), } journeys.append(journey) @@ -143,7 +142,6 @@ class TrainServer(BaseHTTPRequestHandler): "arrival_time": format_datetime( year, month, arr_day, arr_hour, arr_minute ), - "platform": str(random.randint(1, 8)), "price": round(30 + random.random() * 50, 2), } journeys.append(journey)