diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-20 19:34:56 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-20 19:34:56 +0200 |
| commit | c86b4655f72c86362c064dd50bb701782b39e6eb (patch) | |
| tree | 8b4cbd399e984f599044147ee8d74c40ae6a153a /data | |
| parent | 340865ad234f974ec4c0afcbfb6ff06f50a11b2f (diff) | |
Update stop overrides
Diffstat (limited to 'data')
| -rw-r--r-- | data/download-stops.py | 28 | ||||
| -rw-r--r-- | data/stop-overrides.yaml | 71 |
2 files changed, 64 insertions, 35 deletions
diff --git a/data/download-stops.py b/data/download-stops.py index 2720014..957e50d 100644 --- a/data/download-stops.py +++ b/data/download-stops.py @@ -33,12 +33,6 @@ def apply_overrides(stops, overrides): # Apply or add alternate names if "alternateNames" in override: - if isinstance(stop["name"], str): - # Convert simple name to object if it's a string - original_name = stop["name"] - stop["name"] = {"original": original_name} - - # Add alternate names for key, value in override["alternateNames"].items(): stop["name"][key] = value @@ -49,20 +43,14 @@ def apply_overrides(stops, overrides): if "longitude" in override["location"]: stop["longitude"] = override["location"]["longitude"] - # Add notes - if "notes" in override: - stop["notes"] = override["notes"] - - # Add active status - if "active" in override: - stop["active"] = override["active"] - # Add amenities if "amenities" in override: stop["amenities"] = override["amenities"] - - print(f"Applied overrides to stop {stop_id} ({stop['name']})") - + + # Mark stop as hidden if needed + if "hide" in override: + stop["hide"] = override["hide"] + return stops def main(): @@ -100,11 +88,15 @@ def main(): overrides = load_stop_overrides(overrides_file) processed_stops = apply_overrides(processed_stops, overrides) + # Filter out hidden stops + visible_stops = [stop for stop in processed_stops if not stop.get("hide")] + print(f"Removed {len(processed_stops) - len(visible_stops)} hidden stops") + # Save to public directory output_file = os.path.join(script_dir, "..", "public", "stops.json") with open(output_file, 'w', encoding='utf-8') as f: - json.dump(processed_stops, f, ensure_ascii=False, indent=2) + json.dump(visible_stops, f, ensure_ascii=False, indent=2) print(f"Saved processed stops data to {output_file}") return 0 diff --git a/data/stop-overrides.yaml b/data/stop-overrides.yaml index 6dfc23f..f20f633 100644 --- a/data/stop-overrides.yaml +++ b/data/stop-overrides.yaml @@ -7,32 +7,69 @@ # location: # Override location coordinates # latitude: # New latitude value # longitude: # New longitude value -# notes: # Additional notes about the stop -# active: # Boolean to indicate if stop is active +# hide: # Hide the stop from the map and list # amenities: # List of amenities available at this stop # - shelter # Marquesina # - real-time display # Display with real-time information -6930: # Praza de América 1 - alternateNames: - intersect: "Praza América - Camelias" - amenities: - - shelter - - real-time display +#6930: # Praza de América 1 +# alternateNames: -14264: - alternateNames: - intersect: "Urzáiz - Príncipe" - amenities: - - shelter - - real-time display +# intersect: "Praza América - Camelias" +# amenities: +# - shelter +# - real-time display -6620: +#14264: # Urzáiz - Príncipe +# alternateNames: +# intersect: "Urzáiz - Príncipe" +# amenities: +# - shelter +# - real-time display + +6620: # Policarpo Sanz, 40 location: latitude: 42.23757846151978 longitude: -8.721031378896738 -20193: +20193: # Policarpo Sanz, 25 location: latitude: 42.23767601188501 - longitude: -8.721582630122455
\ No newline at end of file + longitude: -8.721582630122455 + +5720: # Gregorio Espino, 33 + location: + latitude: 42.23004933454558 + longitude: -8.706947409683313 + +5710: # Gregorio Espino, 22 + location: + latitude: 42.23003666347398 + longitude: -8.707266671978003 + +5730: # Gregorio Espino, 44 + location: + latitude: 42.227850036119314 + longitude: -8.708105429626789 + +5740: # Gregorio Espino, 57 + location: + latitude: 42.22783722597372 + longitude: -8.707849091551859 + +#region Hidden stops +20223: # Castrelos (Pavillón) - Final U1 + hide: true +20146: # García Barbón 7 - final líneas A y 18A + hide: true +20220: # (Samil) COIA-SAMIL - Final L15A + hide: true +20001: # (Samil) Samil por Beiramar - Final L15B + hide: true +20002: # (Samil) Samil por Torrecedeira - Final L15C + hide: true +20144: # (Samil) Samil por Coia - Final C3D+C3i + hide: true +20145: # (Samil) Samil por Bouzas - Final C3D+C3i + hide: true +#endregion
\ No newline at end of file |
