Move icomera functions into _icomera.fish

This commit is contained in:
Dominik M. Kwiatek 2020-01-30 17:23:23 +00:00
parent c47a7e4bd6
commit 64f850a5cb
3 changed files with 50 additions and 51 deletions

View file

@ -1,5 +1,54 @@
ambient_match_icomera_wifi
set -l ssid (ambient_get_ssid)
switch $ssid
case "GatwickExpress_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_GATWICK_EXPRESS
set -g ambient_icomera_provider "Gatwick Express"
case "Thameslink_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_THAMESLINK
set -g ambient_icomera_provider Thameslink
case "Southern_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_SOUTHERN
set -g ambient_icomera_provider Southern
case "GreatNorthern_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_GREAT_NORTHERN
set -g ambient_icomera_provider "Great Northern"
case "SWR WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_SWR
set -g ambient_icomera_provider "South Western Railway"
case "VirginTrainsEC-WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_VTEC
set -g ambient_icomera_provider "Virgin Trains East Coast"
case "SJ"
set -g ambient_icomera_country SE
set -g ambient_icomera_prefix SE_SJ
set -g ambient_icomera_provider SJ
case "Irish Rail - WiFi"
set -g ambient_icomera_country IE
set -g ambient_icomera_prefix IE_IRISH_RAIL
set -g ambient_icomera_provider "Irish Rail"
case "WIFIonICE"
set -g ambient_icomera_country DE
set -g ambient_icomera_prefix DE_DEUTSCHE_BAHN
set -g ambient_icomera_provider "Deutsche Bahn"
end
if test -n $ambient_icomera_provider
function ambient_get_icomera_endpoint
set url https://www.ombord.info/api/jsonp/$argv/
if test (uname) = "Darwin"
curl -s $url | tail -c +2 | ghead -c -3
else
curl -s $url | tail -c +2 | head -c -3
end
end
set PREFIX "AMBIENT_$ambient_icomera_prefix"
ambient_get_icomera_endpoint position | jq --arg prefix "$PREFIX" -r '"
\($prefix)_POSITION_LONGITUDE=\(.longitude)

View file

@ -1,9 +0,0 @@
function ambient_get_icomera_endpoint
set url https://www.ombord.info/api/jsonp/$argv/
if test (uname) = "Darwin"
curl -s $url | tail -c +2 | ghead -c -3
else
curl -s $url | tail -c +2 | head -c -3
end
end

View file

@ -1,41 +0,0 @@
function ambient_match_icomera_wifi
set -l ssid (ambient_get_ssid)
switch $ssid
case "GatwickExpress_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_GATWICK_EXPRESS
set -g ambient_icomera_provider "Gatwick Express"
case "Thameslink_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_THAMESLINK
set -g ambient_icomera_provider Thameslink
case "Southern_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_SOUTHERN
set -g ambient_icomera_provider Southern
case "GreatNorthern_WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_GREAT_NORTHERN
set -g ambient_icomera_provider "Great Northern"
case "SWR WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_SWR
set -g ambient_icomera_provider "South Western Railway"
case "VirginTrainsEC-WiFi"
set -g ambient_icomera_country GB
set -g ambient_icomera_prefix GB_VTEC
set -g ambient_icomera_provider "Virgin Trains East Coast"
case "SJ"
set -g ambient_icomera_country SE
set -g ambient_icomera_prefix SE_SJ
set -g ambient_icomera_provider SJ
case "Irish Rail - WiFi"
set -g ambient_icomera_country IE
set -g ambient_icomera_prefix IE_IRISH_RAIL
set -g ambient_icomera_provider "Irish Rail"
case "WIFIonICE"
set -g ambient_icomera_country DE
set -g ambient_icomera_prefix DE_DEUTSCHE_BAHN
set -g ambient_icomera_provider "Deutsche Bahn"
end
end