Added view switcher. Added hard coded metars

This commit is contained in:
2022-08-10 00:01:56 -07:00
parent 34cb33b4a6
commit eaa47d312f
3 changed files with 150 additions and 27 deletions

View File

@@ -14,3 +14,25 @@ proc format_predictions*(prd: JSONNode): string =
"No prediction available"
else:
prd["prd"].getElems.map(time => time["prdctdn"].getStr).join(", ")
proc home_predictions*: string =
let client = newHttpClient()
const home_nl = "51067"
const home_12 = "58995"
const home_29 = "56557"
let nl_predictions = client.get_predictions(home_nl, "NL").format_predictions
let twelve_predictions = client.get_predictions(home_12, "12").format_predictions
let twenty_nine_predictions = client.get_predictions(home_29, "29").format_predictions
&"Home\nNL: {nl_predictions}\n12: {twelve_predictions}\n29: {twenty_nine_predictions}"
proc office_predictions*: string =
let client = newHttpClient()
const office_nl = "56565"
const office_12 = "57111"
let nl_predictions = client.get_predictions(office_nl, "NL").format_predictions
let twelve_predictions = client.get_predictions(office_12, "12").format_predictions
&"Oakland Office\nNL: {nl_predictions}\n12: {twelve_predictions}"