Skip to content

Commit

Permalink
Update: Adelaide Metro (#2093)
Browse files Browse the repository at this point in the history
Added default Bus Stop ID to prevent app freezing
  • Loading branch information
M0ntyP authored Dec 7, 2023
1 parent 10a4c0f commit 1382947
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apps/adelaidemetro/adelaide_metro.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ Bug fix for some train stations not showing "CITY" headsign on city bound servic
Updated wording for Bus Stop and Tram Stop in schema dropdown
Fixed issue for last service/services after midnight showing incorrect times. This is an issue with the data from API but added a workaround to make it accurate
v2.2 - Unpublished
v2.2 - Published 13/6
Added handling for service disruption, or situations where there are no services in next 24hrs
Extended display time to 3 seconds
v2.3
Added default Bus Stop ID to prevent app freezing
"""

load("encoding/json.star", "json")
Expand All @@ -55,15 +58,16 @@ def main(config):
SelectedStation = config.get("TramStationList", "17755")

if TrainOrTramOrBus == "Bus":
SelectedStation = config.get("BusStop", 16455)
SelectedStation = config.get("BusStop", "13339")

if TrainOrTramOrBus == "Train":
SelectedStation = config.get("StationList", "16572")
SelectedStation = config.get("StationList", "16571")

if TrainToCity == False:
SelectedStation = AwayStops(SelectedStation)

STOP_ID = str(SelectedStation)
print(STOP_ID)

NEXTSCHED_URL = NEXTSCHED1_URL + STOP_ID
#print(NEXTSCHED_URL)
Expand Down Expand Up @@ -118,7 +122,7 @@ def main(config):
# How many services coming up at this stop
ServicesLookup = len(NEXTSCHED_JSON[2])

# How many in time period specified
# How many services in time period specified
for x in range(0, ServicesLookup, 1):
if NEXTSCHED_JSON[2][x]["min"] <= ReqTime:
Services = Services + 1
Expand Down Expand Up @@ -1312,7 +1316,6 @@ def MoreOptions(TrainOrTramOrBus):
name = "Train Station",
desc = "Choose your station",
icon = "train",
default = StationOptions[0].value,
options = StationOptions,
),
schema.Toggle(
Expand Down Expand Up @@ -1342,6 +1345,7 @@ def MoreOptions(TrainOrTramOrBus):
name = "Bus Stop ID",
desc = "Enter the Stop ID",
icon = "bus",
default = "13339",
),
]
return None
Expand Down

0 comments on commit 1382947

Please sign in to comment.