From 3f95300da30f525848552b9256049c19e5a9fdbd Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 17 Feb 2022 15:50:39 +0100 Subject: [PATCH] update --- .idea/misc.xml | 2 +- .idea/modules.xml | 2 +- README.md | 4 +- config.py | 7 +- eventboard.py | 32 ++++- events.json | 306 +++++++++++++++++++++++----------------------- holidays.json | 304 ++++++++++++++++----------------------------- muell.json | 9 ++ 8 files changed, 298 insertions(+), 368 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index dc9ea49..d56657a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index ce18bf8..897f2c5 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 84b4ed6..2743b9d 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ const char* password = "your password"; { "type": "fixed", "date": { - "day": 8, - "month": 2, + "day": "08", + "month": "02", "year": 1989 }, "name": "Ines {{years}}. Geburtstag", diff --git a/config.py b/config.py index 666e93b..5dea836 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,9 @@ -host = 'Device Ip' # ur device ip, where u upload the matrix.ino -garbage = 'true' # set true if u have a formated Json file +host = '192.168.0.19' # ur device ip, where u upload the matrix.ino +#Edit the Events, decide what u wanna show on you Led Matrix +garbage = 'true' +events = 'true' +holidays = 'false' get_request = '/set?text=' # dont touch this line \ No newline at end of file diff --git a/eventboard.py b/eventboard.py index 368c4cb..81eeae0 100644 --- a/eventboard.py +++ b/eventboard.py @@ -26,22 +26,42 @@ def read_JSON(filename): f.close() return data + # Returns the Garbage def create_Message(): + message = '' + if config.garbage == 'true': for i in read_JSON('muell.json'): day = i['date']['day'] month = i['date']['month'] - year = i['date']['year'] + if day == get_current_date()[0] and month == get_current_date()[1]: + message = message + ' ' + i['name'] + + + if config.events == 'true': + filename = 'events.json' + for i in read_JSON(filename): + day = i['date']['day'] + month = i['date']['month'] + if day == get_current_date()[0] and month == get_current_date()[1]: + message = message + ' ' + i['message'] + + if config.holidays == 'true': + filename = 'holidays.json' + for i in read_JSON(filename): + day = i['date']['day'] + month = i['date']['month'] + if day == get_current_date()[0] and month == get_current_date()[1]: + message = message + ' ' + i['message'] + + + - if day == get_current_date()[0] and \ - month == get_current_date()[1] and \ - year == get_current_date()[2]: - return i['name'] # Send Message to the Device def matrixRequest(): - requests.get('http://' + config.host + config.get_request + create_Message()) + requests.get('http://' + config.host + config.get_request + str(create_Message())) matrixRequest() diff --git a/events.json b/events.json index 3837f76..de3498d 100644 --- a/events.json +++ b/events.json @@ -1,154 +1,152 @@ -{ - "events": [ -{ - "type": "fixed", - "date": { - "day": 21, - "month": 11, - "year": 2021 - }, - "name": "Lottas {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 8, - "month": 2, - "year": 1989 - }, - "name": "Ines {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 2, - "month": 5, - "year": 1961 - }, - "name": "Rudis {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, -{ - "type": "fixed", - "date": { - "day": 1, - "month": 2, - "year": 1936 - }, - "name": "Oma Ferls {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 24, - "month": 5, - "year": 1967 - }, - "name": "Haikes {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 19, - "month": 2, - "year": 1966 - }, - "name": "Marios {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 24, - "month": 12, - "year": 2021 - }, - "name": "{{years}}. Verlobungstag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 21, - "month": 2, - "year": 1985 - }, - "name": "Susannes {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 26, - "month": 3, - "year": 1971 - }, - "name": "Christians Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 21, - "month": 4, - "year": 1999 - }, - "name": "Steffens {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 17, - "month": 1, - "year": 1986 - }, - "name": "Marcus Geburtstag", - "message": "Nur noch {{hours}} Stunden bis zu {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 18, - "month": 9, - "year": 1943 - }, - "name": "Erikas Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 20, - "month": 9, - "year": 1967 - }, - "name": "Michaelas Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 26, - "month": 9, - "year": 1966 - }, - "name": "Markus Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { - "day": 8, - "month": 11, - "year": 1995 - }, - "name": "Viviennes {{years}}. Geburtstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - } - ] -} +[ + { + "type": "fixed", + "date": { + "day": "21", + "month": "11", + "year": 2021 + }, + "name": "Lottas {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "08", + "month": "02", + "year": 1989 + }, + "name": "Ines {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "02", + "month": "05", + "year": 1961 + }, + "name": "Rudis {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "01", + "month": "02", + "year": 1936 + }, + "name": "Oma Ferls {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "24", + "month": "05", + "year": 1967 + }, + "name": "Haikes {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "19", + "month": "02", + "year": 1966 + }, + "name": "Marios {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "24", + "month": "12", + "year": 2021 + }, + "name": "{{years}}. Verlobungstag", + "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "21", + "month": "02", + "year": 1985 + }, + "name": "Susannes {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "26", + "month": "03", + "year": 1971 + }, + "name": "Christians Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "21", + "month": "04", + "year": 1999 + }, + "name": "Steffens {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "17", + "month": "01", + "year": 1986 + }, + "name": "Marcus Geburtstag", + "message": "Nur noch {{hours}} Stunden bis zu {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "18", + "month": "09", + "year": 1943 + }, + "name": "Erikas Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "20", + "month": "09", + "year": 1967 + }, + "name": "Michaelas Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "26", + "month": "09", + "year": 1966 + }, + "name": "Markus Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "08", + "month": "11", + "year": 1995 + }, + "name": "Viviennes {{years}}. Geburtstag", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + } +] \ No newline at end of file diff --git a/holidays.json b/holidays.json index 53ef752..9f54f76 100644 --- a/holidays.json +++ b/holidays.json @@ -1,202 +1,102 @@ -{ - "holidays": [ - { - "type": "fixed", - "date": { "day": 1, "month": 1, "year": 0 }, - "name": "Neujahr", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 1, "month": 5, "year": 1946 }, - "name": "Tag der Arbeit", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 3, "month": 10, "year": 1990 }, - "name": "Tag der deutschen Einheit", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 31, "month": 10, "year": 1850 }, - "name": "Halloween{1}", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 1, "month": 11, "year": 1833 }, - "name": "Allerheiligen", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 11, "month": 11, "year": 1833 }, - "name": "Fastnacht", - "message": "Nur noch {{hours}} Stunden bis die {{name}} beginnt!" - }, - { - "type": "fixed", - "date": { "day": 24, "month": 12, "year": 0 }, - "name": "Heilig Abend", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 25, "month": 12, "year": 0 }, - "name": "1. Weihhnachtstag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 26, "month": 12, "year": 0 }, - "name": "2. Weihhnachtstag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "fixed", - "date": { "day": 31, "month": 12, "year": 0 }, - "name": "Silvester", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "advent", - "days": 0, - "name": "1. Advent", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - - }, - { - "type": "dynamic", - "base": "advent", - "days": 7, - "name": "2. Advent", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - - }, - { - "type": "dynamic", - "base": "advent", - "days": 14, - "name": "3. Advent", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - - }, - { - "type": "dynamic", - "base": "advent", - "days": 21, - "name": "4. Advent", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - - }, - { - "type": "dynamic", - "base": "advent", - "days": -14, - "name": "Volkstrauertag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - - }, - { - "type": "dynamic", - "base": "advent", - "days": -11, - "name": "Buß- und Bettag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "dynamic", - "base": "advent", - "days": -7, - "name": "Totensonntag", - "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -52, - "name": "Weiberfastnacht", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -48, - "name": "Rosenmontag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -47, - "name": "Fastnachtsdienstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -46, - "name": "Aschermittwoch", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -3, - "name": "Gründonnerstag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": -2, - "name": "Karfreitag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 0, - "name": "Ostersonntag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 1, - "name": "Ostermontag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 39, - "name": "Christi Himmelfahrt", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 49, - "name": "Pfingstsonntag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 50, - "name": "Pfingstmontag", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - }, - { - "type": "dynamic", - "base": "easter", - "days": 60, - "name": "Fronleichnam", - "message": "Nur noch {{hours}} Stunden bis {{name}}!" - } - ] -} +[ + { + "type": "fixed", + "date": { + "day": "01", + "month": "01", + "year": 0 + }, + "name": "Neujahr", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "01", + "month": "05", + "year": 1946 + }, + "name": "Tag der Arbeit", + "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "03", + "month": "10", + "year": 1990 + }, + "name": "Tag der deutschen Einheit", + "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "31", + "month": "10", + "year": 1850 + }, + "name": "Halloween{1}", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "01", + "month": "11", + "year": 1833 + }, + "name": "Allerheiligen", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "11", + "month": "11", + "year": 1833 + }, + "name": "Fastnacht", + "message": "Nur noch {{hours}} Stunden bis die {{name}} beginnt!" + }, + { + "type": "fixed", + "date": { + "day": "24", + "month": "12", + "year": 0 + }, + "name": "Heilig Abend", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "25", + "month": "12", + "year": 0 + }, + "name": "1. Weihhnachtstag", + "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "26", + "month": "12", + "year": 0 + }, + "name": "2. Weihhnachtstag", + "message": "Nur noch {{hours}} Stunden bis zum {{name}}!" + }, + { + "type": "fixed", + "date": { + "day": "31", + "month": "12", + "year": 0 + }, + "name": "Silvester", + "message": "Nur noch {{hours}} Stunden bis {{name}}!" + } +] \ No newline at end of file diff --git a/muell.json b/muell.json index 9ff9042..904579f 100644 --- a/muell.json +++ b/muell.json @@ -16,6 +16,15 @@ "year": "2022" }, "name": "Biomuell" + }, + { + "tag": "Di", + "date": { + "day": "17", + "month": "02", + "year": "2022" + }, + "name": "TESTMESSAGE MÜLL" }, { "tag": "Do",