update
This commit is contained in:
parent
d2b22e4d54
commit
4d4c2bd530
|
@ -8,6 +8,14 @@
|
||||||
|
|
||||||
Migration von JavaScript zu Python
|
Migration von JavaScript zu Python
|
||||||
|
|
||||||
|
<h4>Funktionen</h4>
|
||||||
|
<ul>
|
||||||
|
<li>Müllkalender</li>
|
||||||
|
<li>Geburtstage</li>
|
||||||
|
<li>Feiertage</li>
|
||||||
|
<li>Zufällige Zitate</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
### Config
|
### Config
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
host = 'Device IP' # ur device ip, where u upload the matrix.ino
|
host = 'Device_Ip' # ur device ip, where u upload the matrix.ino
|
||||||
|
|
||||||
#Edit the Events, decide what u wanna show on you Led Matrix
|
#Edit the Events, decide what u wanna show on you Led Matrix
|
||||||
garbage = 'true'
|
garbage = 'true'
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Digit converter
|
# Digit converter
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
def digit_convert(filename):
|
def digit_convert(filename):
|
||||||
with open(filename, 'r') as file:
|
with open(filename, 'r') as file:
|
||||||
data = json.load(file)
|
data = json.load(file)
|
||||||
|
@ -12,11 +11,9 @@ def digit_convert(filename):
|
||||||
with open('events.json', 'w') as file:
|
with open('events.json', 'w') as file:
|
||||||
json.dump(data, file, indent=2)
|
json.dump(data, file, indent=2)
|
||||||
|
|
||||||
|
|
||||||
if len(i['date']['month']) != 2:
|
if len(i['date']['month']) != 2:
|
||||||
i['date']['month'] = str('{:02d}'.format(i['date']['month']))
|
i['date']['month'] = str('{:02d}'.format(i['date']['month']))
|
||||||
with open('events.json', 'w') as file:
|
with open('events.json', 'w') as file:
|
||||||
json.dump(data, file, indent=2)
|
json.dump(data, file, indent=2)
|
||||||
|
|
||||||
|
|
||||||
digit_convert('events.json')
|
digit_convert('events.json')
|
|
@ -8,8 +8,7 @@ import json
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import requests
|
import requests
|
||||||
import config
|
import config
|
||||||
import datetime
|
|
||||||
import random
|
|
||||||
|
|
||||||
# Get current Date
|
# Get current Date
|
||||||
def get_current_date():
|
def get_current_date():
|
||||||
|
@ -17,9 +16,8 @@ def get_current_date():
|
||||||
day = str('{:02d}'.format(currentDate.day))
|
day = str('{:02d}'.format(currentDate.day))
|
||||||
month = str('{:02d}'.format(currentDate.month))
|
month = str('{:02d}'.format(currentDate.month))
|
||||||
year = str(currentDate.year)
|
year = str(currentDate.year)
|
||||||
tomorrow_date = date.today() + datetime.timedelta(days=1)
|
return [day, month, year]
|
||||||
tomorrow = str('{:02d}'.format(tomorrow_date.day))
|
|
||||||
return [day, month, year, tomorrow]
|
|
||||||
|
|
||||||
# Raw data from Json file
|
# Raw data from Json file
|
||||||
def read_JSON(filename):
|
def read_JSON(filename):
|
||||||
|
@ -28,13 +26,6 @@ def read_JSON(filename):
|
||||||
f.close()
|
f.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# Creat default Message
|
|
||||||
def default_message():
|
|
||||||
lines = []
|
|
||||||
with open('zitate.txt', 'r') as file:
|
|
||||||
for l in file:
|
|
||||||
lines.append(l)
|
|
||||||
return random.choice(lines)
|
|
||||||
|
|
||||||
# Returns the Garbage
|
# Returns the Garbage
|
||||||
def create_Message():
|
def create_Message():
|
||||||
|
@ -44,9 +35,7 @@ def create_Message():
|
||||||
for i in read_JSON('muell.json'):
|
for i in read_JSON('muell.json'):
|
||||||
day = i['date']['day']
|
day = i['date']['day']
|
||||||
month = i['date']['month']
|
month = i['date']['month']
|
||||||
if day == get_current_date()[3] and month == get_current_date()[1]:
|
if day == get_current_date()[0] and month == get_current_date()[1]:
|
||||||
message = message + ' Morgen: ' + i['name']
|
|
||||||
elif int(day) == int(get_current_date()[0]) and month == get_current_date()[1]:
|
|
||||||
message = message + ' ' + i['name']
|
message = message + ' ' + i['name']
|
||||||
|
|
||||||
if config.events == 'true':
|
if config.events == 'true':
|
||||||
|
@ -54,9 +43,7 @@ def create_Message():
|
||||||
for i in read_JSON(filename):
|
for i in read_JSON(filename):
|
||||||
day = i['date']['day']
|
day = i['date']['day']
|
||||||
month = i['date']['month']
|
month = i['date']['month']
|
||||||
if day == get_current_date()[3] and month == get_current_date()[1]:
|
if day == get_current_date()[0] and month == get_current_date()[1]:
|
||||||
message = message + ' Morgen: ' + i['name']
|
|
||||||
elif int(day) == int(get_current_date()[0]) and month == get_current_date()[1]:
|
|
||||||
message = message + ' ' + i['name']
|
message = message + ' ' + i['name']
|
||||||
|
|
||||||
if config.holidays == 'true':
|
if config.holidays == 'true':
|
||||||
|
@ -64,19 +51,14 @@ def create_Message():
|
||||||
for i in read_JSON(filename):
|
for i in read_JSON(filename):
|
||||||
day = i['date']['day']
|
day = i['date']['day']
|
||||||
month = i['date']['month']
|
month = i['date']['month']
|
||||||
if day == get_current_date()[3] and month == get_current_date()[1]:
|
if day == get_current_date()[0] and month == get_current_date()[1]:
|
||||||
message = message + ' Morgen: ' + i['name']
|
|
||||||
elif int(day) == int(get_current_date()[0]) and month == get_current_date()[1]:
|
|
||||||
message = message + ' ' + i['name']
|
message = message + ' ' + i['name']
|
||||||
|
|
||||||
if len(message) < 5:
|
|
||||||
message = default_message()
|
|
||||||
|
|
||||||
return message
|
|
||||||
|
|
||||||
# Send Message to the Device
|
# Send Message to the Device
|
||||||
def matrixRequest():
|
def matrixRequest():
|
||||||
requests.get('http://' + config.host + config.get_request + str(create_Message()))
|
requests.get('http://' + config.host + config.get_request + str(create_Message()))
|
||||||
|
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
matrixRequest()
|
matrixRequest()
|
||||||
|
|
|
@ -115,7 +115,11 @@ Nur wer sein Ziel kennt, findet den Weg. - Laozi
|
||||||
Der Langsamste, der sein Ziel nur nicht aus den Augen verliert, geht immer noch geschwinder als der, der ohne Ziel herumirrt. - Gotthold Ephraim Lessing
|
Der Langsamste, der sein Ziel nur nicht aus den Augen verliert, geht immer noch geschwinder als der, der ohne Ziel herumirrt. - Gotthold Ephraim Lessing
|
||||||
Ziele zu setzen ist der erste Schritt das unsichtbare in das sichtbare zu verwandeln. - Tony Robbins
|
Ziele zu setzen ist der erste Schritt das unsichtbare in das sichtbare zu verwandeln. - Tony Robbins
|
||||||
Der Mensch arbeitet immer fuer ein Ziel. Wer jedoch keine eigenen Ziele hat, arbeitet fuer die von Anderen. - Brian Tracy
|
Der Mensch arbeitet immer fuer ein Ziel. Wer jedoch keine eigenen Ziele hat, arbeitet fuer die von Anderen. - Brian Tracy
|
||||||
|
<<<<<<< HEAD
|
||||||
Fordert man sich nicht unablaessig selber heraus, verdorrt man. - Lido Lee Iacocca
|
Fordert man sich nicht unablaessig selber heraus, verdorrt man. - Lido Lee Iacocca
|
||||||
|
=======
|
||||||
|
Fordert man sich nicht unablaessig selber heraus, verdorrt man. - Lido ‚Lee‘ Iacocca
|
||||||
|
>>>>>>> 046c2bb (update)
|
||||||
Man muss das Unmoegliche versuchen, um das moegliche zu erreichen. - Hermann Hesse
|
Man muss das Unmoegliche versuchen, um das moegliche zu erreichen. - Hermann Hesse
|
||||||
Nichts verschafft mehr Ruhe, als ein gefasster Entschluss. - Charles Maurice de Talleyrand
|
Nichts verschafft mehr Ruhe, als ein gefasster Entschluss. - Charles Maurice de Talleyrand
|
||||||
Erst Ziele geben unserem Leben einen Sinn.— C.H. Parkhurst
|
Erst Ziele geben unserem Leben einen Sinn.— C.H. Parkhurst
|
||||||
|
|
Loading…
Reference in New Issue
Block a user