summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__pycache__/Adafruit_Thermal.cpython-310.pycbin0 -> 15299 bytes
-rw-r--r--__pycache__/cal.cpython-310.pycbin0 -> 1333 bytes
-rw-r--r--__pycache__/ipqr.cpython-310.pycbin0 -> 630 bytes
-rw-r--r--__pycache__/natDay.cpython-310.pycbin0 -> 666 bytes
-rw-r--r--__pycache__/news.cpython-310.pycbin0 -> 851 bytes
-rw-r--r--__pycache__/quote.cpython-310.pycbin0 -> 603 bytes
-rw-r--r--__pycache__/settings.cpython-310.pycbin0 -> 557 bytes
-rw-r--r--__pycache__/weather.cpython-310.pycbin0 -> 1807 bytes
-rw-r--r--cal.py3
-rw-r--r--main.py6
-rw-r--r--news.py3
-rw-r--r--settings.py18
-rw-r--r--weather.py3
13 files changed, 20 insertions, 13 deletions
diff --git a/__pycache__/Adafruit_Thermal.cpython-310.pyc b/__pycache__/Adafruit_Thermal.cpython-310.pyc
new file mode 100644
index 0000000..e5d720c
--- /dev/null
+++ b/__pycache__/Adafruit_Thermal.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/cal.cpython-310.pyc b/__pycache__/cal.cpython-310.pyc
new file mode 100644
index 0000000..14ff64d
--- /dev/null
+++ b/__pycache__/cal.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/ipqr.cpython-310.pyc b/__pycache__/ipqr.cpython-310.pyc
new file mode 100644
index 0000000..7a37ec8
--- /dev/null
+++ b/__pycache__/ipqr.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/natDay.cpython-310.pyc b/__pycache__/natDay.cpython-310.pyc
new file mode 100644
index 0000000..cff9b88
--- /dev/null
+++ b/__pycache__/natDay.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/news.cpython-310.pyc b/__pycache__/news.cpython-310.pyc
new file mode 100644
index 0000000..16bec00
--- /dev/null
+++ b/__pycache__/news.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/quote.cpython-310.pyc b/__pycache__/quote.cpython-310.pyc
new file mode 100644
index 0000000..adcd0a8
--- /dev/null
+++ b/__pycache__/quote.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/settings.cpython-310.pyc b/__pycache__/settings.cpython-310.pyc
new file mode 100644
index 0000000..78b5539
--- /dev/null
+++ b/__pycache__/settings.cpython-310.pyc
Binary files differ
diff --git a/__pycache__/weather.cpython-310.pyc b/__pycache__/weather.cpython-310.pyc
new file mode 100644
index 0000000..c9460a8
--- /dev/null
+++ b/__pycache__/weather.cpython-310.pyc
Binary files differ
diff --git a/cal.py b/cal.py
index 4f32465..348fa32 100644
--- a/cal.py
+++ b/cal.py
@@ -2,8 +2,9 @@ import icalendar
import recurring_ical_events
import urllib.request
import datetime
-from settings import calendars
+from settings import getSettings
+calendars = getSettings("calendars")
today = datetime.date.today()
output = []
diff --git a/main.py b/main.py
index 6df9aef..4d2f61c 100644
--- a/main.py
+++ b/main.py
@@ -4,13 +4,17 @@ from news import getHeadlines
from quote import getQuote
from weather import getHourlyForecast, getDetailedForecast
import datetime
-from settings import modules, general, lineWidth
+from settings import getSettings
from time import sleep
from Adafruit_Thermal import *
from textwrap import fill
from ipqr import getQrCode
+general = getSettings("general")
+modules = getSettings("modules")
+
name = general["name"]
+lineWidth = general["Line Width"]
today = datetime.date.today().strftime("%A %m-%d-%Y")
printer = Adafruit_Thermal("/dev/serial0", 19200, timeout=5)
diff --git a/news.py b/news.py
index e9afeab..cdec011 100644
--- a/news.py
+++ b/news.py
@@ -1,8 +1,9 @@
import requests
import json
from time import sleep
-from settings import news
+from settings import getSettings
+news = getSettings("news")
apiKey = news["apikey"]
countryCode = news["country"]
diff --git a/settings.py b/settings.py
index c5ed5c7..e94dbe2 100644
--- a/settings.py
+++ b/settings.py
@@ -1,14 +1,14 @@
import json
+from logging import exception
-settingsJSON = open('settings.json')
+def getSettings(settingSection):
+ try:
+ settingsJSON = open("settings.json", "r")
+ except FileNotFoundError:
+ exception("settings.json not found make sure it exists in this folder")
-settings = json.load(settingsJSON)
+ settings = json.load(settingsJSON)
+ settingsJSON.close()
-calendars = settings["calendars"]
-weather = settings["weather"]
-news = settings["news"]
-modules = settings["modules"]
-general = settings["general"]
-lineWidth = settings["general"]["Line Width"]
+ return settings[settingSection]
-settingsJSON.close()
diff --git a/weather.py b/weather.py
index 72323fc..76af11a 100644
--- a/weather.py
+++ b/weather.py
@@ -2,8 +2,9 @@ import requests
import json
from time import sleep
from datetime import datetime
-from settings import weather
+from settings import getSettings
+weather = getSettings("weather")
gridX = weather["gridX"]
gridY = weather["gridY"]
wfo = weather["WFO"]