From 66078904318ce51b2dc23301f7c5b98056f2bb6f Mon Sep 17 00:00:00 2001 From: fly Date: Sun, 3 May 2020 22:01:00 +1000 Subject: [PATCH] Initial commit Signed-off-by: fly --- aloftWxr.py | 8 ++++++++ config.py | 35 +++++++++++++++++++++++++++++++++++ dataCycle.py | 0 fg.py | 0 functions.py | 0 wind.py | 0 6 files changed, 43 insertions(+) create mode 100755 aloftWxr.py create mode 100644 config.py create mode 100644 dataCycle.py create mode 100644 fg.py create mode 100644 functions.py create mode 100644 wind.py diff --git a/aloftWxr.py b/aloftWxr.py new file mode 100755 index 0000000..08f3bde --- /dev/null +++ b/aloftWxr.py @@ -0,0 +1,8 @@ +#! /usr/bin/python3 + +import pygrib +import sys + +from config import config + +conf = config() diff --git a/config.py b/config.py new file mode 100644 index 0000000..022e63e --- /dev/null +++ b/config.py @@ -0,0 +1,35 @@ +import sys +import os + +class config: + def __init__(self): + self.host = "localhost" + self.port = 1711 + if os.name == 'nt': # If on windows + # TODO give windows path + pass + else: + self.tmpPath = "/tmp" + + argc = len(sys.argv) + i = 1 + while i < argc: + if sys.argv[i] == "-h" or sys.argv[i] == "--help": + print("Usage: aloftWxr.py [OPTIONS]") + print("Fetch live weather from NOAA servers and loads it into FlightGear") + print("OPTIONS") + print(" -h, --help Shows this help and exit") + print(" -f, --host FlightGear host. Default 'localhost'") + print(" -p, --port FLightGear port. Default 1711") + print(" -t, --tmp Directory for temporary files") + sys.exit(0) + elif sys.argv[i] == "-f" or sys.argv[i] == "--host": + i += 1 + self.host = sys.argv[i] + elif sys.argv[i] == "-p" or sys.argv[i] == "--port": + i += 1 + self.port = sys.argv[i] + elif sys.argv[i] == "-t" or sys.argv[i] == "--tmp": + i += 1 + self.tmpPath = sys.argv[i] + i += 1 diff --git a/dataCycle.py b/dataCycle.py new file mode 100644 index 0000000..e69de29 diff --git a/fg.py b/fg.py new file mode 100644 index 0000000..e69de29 diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..e69de29 diff --git a/wind.py b/wind.py new file mode 100644 index 0000000..e69de29