2020-01-30 17:23:23 +00:00
|
|
|
set -l ssid (ambient_get_ssid)
|
|
|
|
switch $ssid
|
|
|
|
case "GatwickExpress_WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider "Gatwick Express"
|
2020-01-30 17:23:23 +00:00
|
|
|
case "Thameslink_WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider Thameslink
|
2020-01-30 17:23:23 +00:00
|
|
|
case "Southern_WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider Southern
|
2020-01-30 17:23:23 +00:00
|
|
|
case "GreatNorthern_WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider "Great Northern"
|
2020-01-30 17:23:23 +00:00
|
|
|
case "SWR WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider "South Western Railway"
|
2020-01-30 17:23:23 +00:00
|
|
|
case "VirginTrainsEC-WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider "Virgin Trains East Coast"
|
2022-03-11 19:00:34 +00:00
|
|
|
case "TPE Wi-Fi"
|
|
|
|
set ambient_icomera_country GB
|
|
|
|
set ambient_icomera_provider "TransPennine Express"
|
2020-01-30 17:23:23 +00:00
|
|
|
case "SJ"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country SE
|
|
|
|
set ambient_icomera_provider SJ
|
2020-01-30 17:23:23 +00:00
|
|
|
case "Irish Rail - WiFi"
|
2020-02-04 08:17:28 +00:00
|
|
|
set ambient_icomera_country IE
|
|
|
|
set ambient_icomera_provider "Irish Rail"
|
|
|
|
case "THALYSNET"
|
|
|
|
set ambient_icomera_country FR
|
2022-07-20 07:45:33 +00:00
|
|
|
set ambient_icomera_provider Thalys
|
2020-01-30 17:23:23 +00:00
|
|
|
end
|
2022-07-20 07:47:01 +00:00
|
|
|
test -n "$ambient_icomera_provider"; or exit
|
2020-01-30 17:23:23 +00:00
|
|
|
|
2022-07-20 07:47:01 +00:00
|
|
|
function ambient_get_icomera_endpoint
|
|
|
|
set url https://www.ombord.info/api/jsonp/$argv/
|
2020-01-30 17:23:23 +00:00
|
|
|
|
2022-07-20 07:47:01 +00:00
|
|
|
if test (uname) = "Darwin"
|
|
|
|
curl -s $url | tail -c +2 | ghead -c -3
|
|
|
|
else
|
|
|
|
curl -s $url | tail -c +2 | head -c -3
|
2020-02-04 08:17:28 +00:00
|
|
|
end
|
2022-07-20 07:47:01 +00:00
|
|
|
end
|
2020-01-30 17:23:23 +00:00
|
|
|
|
2022-07-20 07:47:01 +00:00
|
|
|
echo AMBIENT_ICOMERA_PROVIDER=$ambient_icomera_provider
|
|
|
|
echo AMBIENT_ICOMERA_COUNTRY=$ambient_icomera_country
|
|
|
|
ambient_get_icomera_endpoint position | jq -r '"
|
2020-01-30 17:36:58 +00:00
|
|
|
AMBIENT_ICOMERA_POSITION_LONGITUDE=\(.longitude)
|
|
|
|
AMBIENT_ICOMERA_POSITION_LATITUDE=\(.latitude)
|
|
|
|
AMBIENT_ICOMERA_POSITION_ALTITUDE=\(.altitude)
|
|
|
|
AMBIENT_ICOMERA_POSITION_SPEED=\(.speed)
|
|
|
|
AMBIENT_ICOMERA_POSITION_SATELLITES=\(.satellites)
|
2020-01-23 18:07:41 +00:00
|
|
|
"'
|
2022-07-20 07:47:01 +00:00
|
|
|
ambient_get_icomera_endpoint users | jq -r '"
|
2020-01-30 17:36:58 +00:00
|
|
|
AMBIENT_ICOMERA_USERS_TOTAL=\(.total)
|
|
|
|
AMBIENT_ICOMERA_USERS_ONLINE=\(.online)
|
2020-01-23 18:07:41 +00:00
|
|
|
"'
|
2022-07-20 07:47:01 +00:00
|
|
|
ambient_get_icomera_endpoint user | jq -r '"
|
2020-01-30 17:36:58 +00:00
|
|
|
AMBIENT_ICOMERA_USER_DATA_DOWNLOAD_USED=\(.data_download_used)
|
|
|
|
AMBIENT_ICOMERA_USER_DATA_UPLOAD_USED=\(.data_upload_used)
|
|
|
|
AMBIENT_ICOMERA_USER_DATA_TOTAL_USED=\(.data_total_used)
|
|
|
|
AMBIENT_ICOMERA_USER_DATA_DOWNLOAD_LIMIT=\(.data_download_limit)
|
|
|
|
AMBIENT_ICOMERA_USER_DATA_UPLOAD_LIMIT=\(.data_upload_limit)
|
|
|
|
AMBIENT_ICOMERA_USER_DATA_TOTAL_LIMIT=\(.data_total_limit)
|
|
|
|
AMBIENT_ICOMERA_USER_BANDWIDTH_DOWNLOAD_LIMIT=\(.bandwidth_download_limit)
|
|
|
|
AMBIENT_ICOMERA_USER_BANDWIDTH_UPLOAD_LIMIT=\(.bandwidth_upload_limit)
|
|
|
|
AMBIENT_ICOMERA_USER_TIME_USER=\(.timeused)
|
|
|
|
AMBIENT_ICOMERA_USER_TIME_LEFT=\(.timeleft)
|
|
|
|
AMBIENT_ICOMERA_USER_EXPIRES=\(.expires)
|
|
|
|
AMBIENT_ICOMERA_USER_CLASS=\(.userclass)
|
|
|
|
AMBIENT_ICOMERA_USER_ONLINE=\(.online)
|
|
|
|
AMBIENT_ICOMERA_USER_CAP_LEVEL=\(.cap_level)
|
|
|
|
AMBIENT_ICOMERA_USER_AUTHENTICATED=\(.authenticated)
|
2020-01-23 18:07:41 +00:00
|
|
|
"'
|