summaryrefslogtreecommitdiff
path: root/getjson.sh
diff options
context:
space:
mode:
authorars <asav1410@gmail.com>2020-10-06 18:00:43 +0100
committerars <asav1410@gmail.com>2020-10-06 18:00:43 +0100
commite9ae14f67aecf6d5d82bb8769c880abad77f65a1 (patch)
treecf2332175b712d68b0bf6eae99c2e6e39c799bac /getjson.sh
parent6624128599ae0e021cb5097b56caae9215ed9c4c (diff)
remove hash checks as the data received from API is inconsistent anyway and App-Key header so we can actually query API
Diffstat (limited to 'getjson.sh')
-rw-r--r--getjson.sh30
1 files changed, 6 insertions, 24 deletions
diff --git a/getjson.sh b/getjson.sh
index bce999f..1a2e359 100644
--- a/getjson.sh
+++ b/getjson.sh
@@ -1,25 +1,7 @@
#!/bin/bash
-if [ ! -f ./timetable_full.json ]; then
- curl --silent https://admin.libertybus.je/cache/timetables/timetable_full.json > ./timetable_full.json
- md5sum ./timetable_full.json | cut -f1 -d ' ' > timetable_full.json.md5hash.txt
-else
- curl --silent https://admin.libertybus.je/cache/timetables/timetable_full.json > ./timetable_full.new.json
- newHash=`md5sum timetable_full.new.json | cut -f1 -d ' '`
- if [ $newHash != ./timetable_full.json.md5hash.txt ]; then
- rm ./timetable_full.json && rm ./timetable_full.json.md5hash.txt
- mv ./timetable_full.new.json ./timetable_full.json
- echo "$newHash" > ./timetable_full.json.md5hash.txt
- fi
-fi
-if [ ! -f ./service_updates.json ]; then
- curl --silent https://admin.libertybus.je/api/v1/service_updates > ./service_updates.json
- md5sum ./service_updates.json | cut -f1 -d ' ' > service_updates.json.md5hash.txt
-else
- curl --silent https://admin.libertybus.je/api/v1/service_updates > ./service_updates.new.json
- newHash=`md5sum service_updates.new.json | cut -f1 -d ' '`
- if [ $newHash != ./service_updates.json.md5hash.txt ]; then
- rm ./service_updates.json && rm ./service_updates.json.md5hash.txt
- mv ./service_updates.new.json ./service_updates.json
- echo "$newHash" > ./service_updates.json.md5hash.txt
- fi
-fi
+
+# set destination directory
+directory=/home/ars/
+
+curl --silent -H "App-Key: A4E247A48AAF12BF2E97D9F346E56" https://admin.libertybus.je/cache/timetables/timetable_full.json > $directory/timetable_full.json
+curl --silent -H "App-Key: A4E247A48AAF12BF2E97D9F346E56" https://admin.libertybus.je/api/v1/service_updates > $directory/service_updates.json