Tidied sync function
authorCian Bagshaw <cian@cianb.xyz>
Sun, 26 Mar 2023 11:23:38 +0000 (12:23 +0100)
committerCian Bagshaw <cian@cianb.xyz>
Sun, 26 Mar 2023 11:23:38 +0000 (12:23 +0100)
buseir

diff --git a/buseir b/buseir
index 36a5d12..2c01b9a 100755 (executable)
--- a/buseir
+++ b/buseir
@@ -8,10 +8,10 @@ MAP=http://www.google.com/maps/place
 sync() {
        echo Syncing data...
        [ ! -d $TMP ] && mkdir -p $TMP
-       wget "$SITE/inc/proto/bus_stop_points.php" -qO $TMP/busp \
+       wget "$SITE/inc/proto/bus_stop_points.php" -qO $TMP/stops \
                || (echo Connection failed! && exit);
-       head -c -1 $TMP/busp | tail -c +27 | jq -r '.bus_stops|.[]|.[]' \
-               | paste -d "," - - - - - > "$CACHE"/stops.csv;
+       grep -o "{.*}" $TMP/stops | jq -r '.bus_stops[][]' \
+               | paste -d, - - - - - > $CACHE/stops.csv
 }
 
 stopInfo() {