Files
Betroffene/Betroffene.py

94 lines
2.4 KiB
Python

# Betroffene BY DANIEL SCHLAPA
# Bsp. QRCODE: Mustermann;Max;01.01.2024;m;40000;Musterstadt;deutsch;Musterstraße 1;;;;;;
# qrcode = "Mustermann;Max;01.01.2024;m;40000;Musterstadt;deutsch;Musterstraße 1;;;;;;"
import time
import qrcode
# print(time.strftime("%d%H%M%b%y"))
# print(time.strftime("%d.%m.%Y %H:%M:%S"))
"""
try:
<Code, der einen Fehler werfen könnte>
except <Fehlertyp, z.B. ValueError>:
<Fehlerbehandlung>
if ';' in string:
<Mehrere Werte>
else:
<Ein Wert>
"""
def input_code():
scancode = input("Scan den QR-Code: ").strip()
if ';' in scancode:
kompletter_qrcode = scancode
nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse, _, _, _, _, _, _ = kompletter_qrcode.split(";")
kompletter_name = nachname + ", " + vorname
print("AUSGABE DER DATEN")
print("-----------------\n")
print(f"Kompletter Name: {kompletter_name}")
print("Vorname: " + vorname)
print("Nachname: " + nachname)
print("Straße: " + strasse)
print(f"Postleitzzahl + Ort: {plz} {ort}")
print("Geburtsdatum: " + geburtsdatum)
print("Geschlecht: " + geschlecht)
print("Nationalität: " + nationalitaet)
start_datum = time.strftime("%d.%m.%Y")
start_uhrzeit = time.strftime("%H:%M:%S")
print(f"Erfasst um: {start_datum} - {start_uhrzeit}")
else:
print("Code: " + scancode)
return nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse
def make_qrcode():
dateinname_qrcode = input("Dateiname: ").strip()
img = qrcode.make('Daniel')
img.save(dateinname_qrcode + ".png")
print("QR-Code " + dateinname_qrcode + ".png" + " wurde erstellt.")
return dateinname_qrcode
def main():
print("""Menü
----
[1] - Betroffne einregistrieren
[2] - Betroffne ausregistrieren
[3] - Betroffne suchen
[4] - QR-Code erstellen
[5] - Test
[6] - Ende""")
while True:
menu_auswahl = int(input("Menüpunkt: "))
if (menu_auswahl == 1):
input_code()
elif (menu_auswahl == 2):
print("SORRY - 2")
elif (menu_auswahl == 3):
print("SORRY - 3")
elif (menu_auswahl == 4):
make_qrcode()
elif (menu_auswahl == 5):
print("SORRY - 5")
elif (menu_auswahl == 6):
return
else:
print("Auswahl ist ungültig!")
if __name__ == '__main__':
main()